Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 125 lines (112 sloc) 3.036 kb
c7e6e73 @Themaister Fix a blooper in headers.
authored
1 /* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
2267c7d @Themaister Update licensing headers.
authored
2 * Copyright (C) 2010-2011 - Hans-Kristian Arntzen
7b5969c @Themaister some common error routine, and more stringent error checking.
authored
3 *
4 * Some code herein may be based on code found in BSNES.
5 *
6 * SSNES is free software: you can redistribute it and/or modify it under the terms
7 * of the GNU General Public License as published by the Free Software Found-
8 * ation, either version 3 of the License, or (at your option) any later version.
9 *
10 * SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with SSNES.
15 * If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef __GL_COMMON_H
19 #define __GL_COMMON_H
20
04d0d84 @Themaister Fix up more paths.
authored
21 #include "../general.h"
36d9adb @Themaister *Shrug* windows. Works at least ... :D
authored
22 #include <assert.h>
23
24 #ifdef HAVE_CONFIG_H
04d0d84 @Themaister Fix up more paths.
authored
25 #include "../config.h"
36d9adb @Themaister *Shrug* windows. Works at least ... :D
authored
26 #endif
7b5969c @Themaister some common error routine, and more stringent error checking.
authored
27
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
28 #ifdef __APPLE__
29 #include <OpenGL/gl.h>
30 #include <OpenGL/glext.h>
31 #else
f8aaf1d (PS3) Some more commits
TwinAphex51224 authored
32 #ifdef __CELLOS_LV2__
33 #include <PSGL/psgl.h>
34 #include <PSGL/psglu.h>
35 #include <GLES/glext.h>
36 #else
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
37 #define GL_GLEXT_PROTOTYPES
38 #include <GL/gl.h>
39 #include <GL/glext.h>
40 #endif
f8aaf1d (PS3) Some more commits
TwinAphex51224 authored
41 #endif
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
42
7b5969c @Themaister some common error routine, and more stringent error checking.
authored
43 static inline bool gl_check_error(void)
44 {
45 int error = glGetError();
46 switch (error)
47 {
48 case GL_INVALID_ENUM:
49 SSNES_ERR("GL: Invalid enum.\n");
50 break;
51 case GL_INVALID_VALUE:
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
52 SSNES_ERR("GL: Invalid value. (You're not alone.)\n");
7b5969c @Themaister some common error routine, and more stringent error checking.
authored
53 break;
54 case GL_INVALID_OPERATION:
55 SSNES_ERR("GL: Invalid operation.\n");
56 break;
57 case GL_STACK_OVERFLOW:
58 SSNES_ERR("GL: Stack overflow. (wtf)\n");
59 break;
60 case GL_STACK_UNDERFLOW:
61 SSNES_ERR("GL: Stack underflow. (:v)\n");
62 break;
63 case GL_OUT_OF_MEMORY:
64 SSNES_ERR("GL: Out of memory. Harhar.\n");
65 break;
66 case GL_TABLE_TOO_LARGE:
67 SSNES_ERR("GL: Table too large. Big tables scare you! :(\n");
68 break;
69 case GL_NO_ERROR:
70 return true;
71 break;
72 default:
73 SSNES_ERR("Non specified error :v\n");
74 }
75
76 return false;
77 }
78
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
79 struct gl_fbo_rect
80 {
56ac7b4 @Themaister Something's working :D
authored
81 unsigned img_width;
82 unsigned img_height;
936b7f5 @Themaister Seems to work now.
authored
83 unsigned max_img_width;
84 unsigned max_img_height;
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
85 unsigned width;
86 unsigned height;
e2daab9 @Themaister Fetch some scale values (this is not in the standard (yet!))
authored
87 };
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
88
29808c4 @Themaister Start on outscale/size support.
authored
89 enum gl_scale_type
90 {
91 SSNES_SCALE_ABSOLUTE,
92 SSNES_SCALE_INPUT,
93 SSNES_SCALE_VIEWPORT
94 };
95
e2daab9 @Themaister Fetch some scale values (this is not in the standard (yet!))
authored
96 struct gl_fbo_scale
97 {
29808c4 @Themaister Start on outscale/size support.
authored
98 enum gl_scale_type type_x;
99 enum gl_scale_type type_y;
e2daab9 @Themaister Fetch some scale values (this is not in the standard (yet!))
authored
100 float scale_x;
101 float scale_y;
29808c4 @Themaister Start on outscale/size support.
authored
102 unsigned abs_x;
103 unsigned abs_y;
e2daab9 @Themaister Fetch some scale values (this is not in the standard (yet!))
authored
104 bool valid;
ef19ea7 @Themaister Add fbo structures, ready to implement. :v
authored
105 };
106
f9c5c7c @Themaister Path to check initial texture with GLSL.
authored
107 struct gl_tex_info
108 {
109 GLuint tex;
508cfdb @Themaister Start implementing access to previous texture.
authored
110 GLfloat input_size[2];
111 GLfloat tex_size[2];
112 GLfloat coord[8];
f9c5c7c @Themaister Path to check initial texture with GLSL.
authored
113 };
114
36d9adb @Themaister *Shrug* windows. Works at least ... :D
authored
115 // Windows ... <_<
5dced40 @Themaister LUT textures work :)
authored
116 #if (defined(HAVE_XML) || defined(HAVE_CG)) && defined(_WIN32)
2f858b7 @Themaister Clean up ugly inline stuff. :\
authored
117 extern PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture;
118 extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
36d9adb @Themaister *Shrug* windows. Works at least ... :D
authored
119 #else
120 #define pglClientActiveTexture glClientActiveTexture
121 #define pglActiveTexture glActiveTexture
122 #endif
123
7b5969c @Themaister some common error routine, and more stringent error checking.
authored
124 #endif
Something went wrong with that request. Please try again.