1 #ifndef _SDL_GPU_OPENGL_1_H__
2 #define _SDL_GPU_OPENGL_1_H__
6 #if !defined(SDL_GPU_DISABLE_OPENGL) && !defined(SDL_GPU_DISABLE_OPENGL_1)
16 #if defined(GL_EXT_bgr) && !defined(GL_BGR)
17 #define GL_BGR GL_BGR_EXT
19 #if defined(GL_EXT_bgra) && !defined(GL_BGRA)
20 #define GL_BGRA GL_BGRA_EXT
22 #if defined(GL_EXT_abgr) && !defined(GL_ABGR)
23 #define GL_ABGR GL_ABGR_EXT
26 #undef glBlendFuncSeparate
27 #define glBlendFuncSeparate glBlendFuncSeparateEXT
28 #undef glBlendEquation
29 #define glBlendEquation glBlendEquationEXT
30 #undef glBlendEquationSeparate
31 #define glBlendEquationSeparate glBlendEquationSeparateEXT
33 #undef GL_MIRRORED_REPEAT
34 #define GL_MIRRORED_REPEAT GL_MIRRORED_REPEAT_ARB
37 #undef GL_VERTEX_SHADER
38 #undef GL_FRAGMENT_SHADER
40 #undef glCompileShader
42 #undef GL_COMPILE_STATUS
43 #undef glGetShaderInfoLog
45 #undef glActiveTexture
47 #define glCreateShader glCreateShaderObjectARB
48 #define GL_VERTEX_SHADER GL_VERTEX_SHADER_ARB
49 #define GL_FRAGMENT_SHADER GL_FRAGMENT_SHADER_ARB
50 #define glShaderSource glShaderSourceARB
51 #define glCompileShader glCompileShaderARB
52 #define glGetShaderiv glGetObjectParameterivARB
53 #define GL_COMPILE_STATUS GL_OBJECT_COMPILE_STATUS_ARB
54 #define glGetShaderInfoLog glGetInfoLogARB
55 #define glDeleteShader glDeleteObjectARB
56 #define glActiveTexture glActiveTextureARB
57 #define GL_TEXTURE0 GL_TEXTURE0_ARB
59 #undef glCreateProgram
64 #undef glGetProgramInfoLog
66 #undef glDeleteProgram
67 #define glCreateProgram glCreateProgramObjectARB
68 #define glAttachShader glAttachObjectARB
69 #define glLinkProgram glLinkProgramARB
70 #define GL_LINK_STATUS GL_OBJECT_LINK_STATUS_ARB
71 #define glGetProgramiv glGetObjectParameterivARB
72 #define glGetProgramInfoLog glGetInfoLogARB
73 #define glUseProgram glUseProgramObjectARB
74 #define glDeleteProgram glDeleteObjectARB
76 #undef glGetUniformLocation
88 #undef glUniformMatrix4fv
89 #define glGetUniformLocation glGetUniformLocationARB
90 #define glGetUniformiv glGetUniformivARB
91 #define glUniform1i glUniform1iARB
92 #define glUniform1iv glUniform1ivARB
93 #define glUniform2iv glUniform2ivARB
94 #define glUniform3iv glUniform3ivARB
95 #define glUniform4iv glUniform4ivARB
96 #define glUniform1f glUniform1fARB
97 #define glUniform1fv glUniform1fvARB
98 #define glUniform2fv glUniform2fvARB
99 #define glUniform3fv glUniform3fvARB
100 #define glUniform4fv glUniform4fvARB
101 #define glUniformMatrix4fv glUniformMatrix4fvARB
103 #undef glGetAttribLocation
104 #undef glVertexAttrib1f
105 #undef glVertexAttrib2f
106 #undef glVertexAttrib3f
107 #undef glVertexAttrib4f
108 #undef glVertexAttribI1i
109 #undef glVertexAttribI2i
110 #undef glVertexAttribI3i
111 #undef glVertexAttribI4i
112 #undef glVertexAttribI1ui
113 #undef glVertexAttribI2ui
114 #undef glVertexAttribI3ui
115 #undef glVertexAttribI4ui
116 #define glGetAttribLocation glGetAttribLocationARB
117 #define glVertexAttrib1f glVertexAttrib1fARB
118 #define glVertexAttrib2f glVertexAttrib2fARB
119 #define glVertexAttrib3f glVertexAttrib3fARB
120 #define glVertexAttrib4f glVertexAttrib4fARB
121 #define glVertexAttribI1i glVertexAttrib1sARB
122 #define glVertexAttribI2i glVertexAttrib2sARB
123 #define glVertexAttribI3i glVertexAttrib3sARB
124 #define glVertexAttribI4i glVertexAttrib4sARB
125 #define glVertexAttribI1ui glVertexAttrib1sARB
126 #define glVertexAttribI2ui glVertexAttrib2sARB
127 #define glVertexAttribI3ui glVertexAttrib3sARB
128 #define glVertexAttribI4ui glVertexAttrib4sARB
131 #undef glDeleteBuffers
134 #undef glBufferSubData
135 #undef GL_ARRAY_BUFFER
136 #define glGenBuffers glGenBuffersARB
137 #define glDeleteBuffers glDeleteBuffersARB
138 #define glBindBuffer glBindBufferARB
139 #define glBufferData glBufferDataARB
140 #define glBufferSubData glBufferSubDataARB
141 #define GL_ARRAY_BUFFER GL_ARRAY_BUFFER_ARB
144 #undef glEnableVertexAttribArray
145 #undef glDisableVertexAttribArray
146 #undef glVertexAttribPointer
147 #define glEnableVertexAttribArray glEnableVertexAttribArrayARB
148 #define glDisableVertexAttribArray glDisableVertexAttribArrayARB
149 #define glVertexAttribPointer glVertexAttribPointerARB
155 #define GPU_CONTEXT_DATA ContextData_OpenGL_1
156 #define GPU_IMAGE_DATA ImageData_OpenGL_1
157 #define GPU_TARGET_DATA TargetData_OpenGL_1
162 #define GPU_DEFAULT_TEXTURED_VERTEX_SHADER_SOURCE \
165 attribute vec2 gpu_Vertex;\n\
166 attribute vec2 gpu_TexCoord;\n\
167 attribute vec4 gpu_Color;\n\
168 uniform mat4 gpu_ModelViewProjectionMatrix;\n\
170 varying vec4 color;\n\
171 varying vec2 texCoord;\n\
175 color = gpu_Color;\n\
176 texCoord = vec2(gpu_TexCoord);\n\
177 gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 0.0, 1.0);\n\
181 #define GPU_DEFAULT_UNTEXTURED_VERTEX_SHADER_SOURCE \
184 attribute vec2 gpu_Vertex;\n\
185 attribute vec4 gpu_Color;\n\
186 uniform mat4 gpu_ModelViewProjectionMatrix;\n\
188 varying vec4 color;\n\
192 color = gpu_Color;\n\
193 gl_Position = gpu_ModelViewProjectionMatrix * vec4(gpu_Vertex, 0.0, 1.0);\n\
197 #define GPU_DEFAULT_TEXTURED_FRAGMENT_SHADER_SOURCE \
200 varying vec4 color;\n\
201 varying vec2 texCoord;\n\
203 uniform sampler2D tex;\n\
207 gl_FragColor = texture2D(tex, texCoord) * color;\n\
210 #define GPU_DEFAULT_UNTEXTURED_FRAGMENT_SHADER_SOURCE \
213 varying vec4 color;\n\
217 gl_FragColor = color;\n\
unsigned short blit_buffer_num_vertices
unsigned short blit_buffer_max_num_vertices
Uint8 last_camera_inverted
GPU_AttributeSource shader_attributes[16]
GPU_ShaderBlock shader_block[2]
struct ImageData_OpenGL_1 ImageData_OpenGL_1
GPU_ShaderBlock current_shader_block
unsigned int attribute_VBO[16]
unsigned int index_buffer_max_num_vertices
GPU_BlendMode last_blend_mode
struct TargetData_OpenGL_1 TargetData_OpenGL_1
struct ContextData_OpenGL_1 ContextData_OpenGL_1
unsigned short * index_buffer
unsigned int index_buffer_num_vertices