1 /*
2 ===========================================================================
3 
4 Return to Castle Wolfenstein multiplayer GPL Source Code
5 Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Return to Castle Wolfenstein multiplayer GPL Source Code (“RTCW MP Source Code”).
8 
9 RTCW MP Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 RTCW MP Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with RTCW MP Source Code.  If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the RTCW MP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW MP Source Code.  If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 /*
30 ** QGL.H
31 */
32 
33 #ifndef __QGL_H__
34 #define __QGL_H__
35 
36 #ifdef USE_LOCAL_HEADERS
37 #	include "SDL_opengl.h"
38 #else
39 #	include <SDL_opengl.h>
40 #endif
41 
42 extern void (APIENTRYP qglActiveTextureARB) (GLenum texture);
43 extern void (APIENTRYP qglClientActiveTextureARB) (GLenum texture);
44 extern void (APIENTRYP qglMultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t);
45 
46 extern void (APIENTRYP qglLockArraysEXT) (GLint first, GLsizei count);
47 extern void (APIENTRYP qglUnlockArraysEXT) (void);
48 
49 //===========================================================================
50 
51 /*
52 ** multitexture extension definitions
53 */
54 #define GL_ACTIVE_TEXTURE_ARB               0x84E0
55 #define GL_CLIENT_ACTIVE_TEXTURE_ARB        0x84E1
56 #define GL_MAX_ACTIVE_TEXTURES_ARB          0x84E2
57 
58 #define GL_TEXTURE0_ARB                     0x84C0
59 #define GL_TEXTURE1_ARB                     0x84C1
60 #define GL_TEXTURE2_ARB                     0x84C2
61 #define GL_TEXTURE3_ARB                     0x84C3
62 
63 /*
64 ** extension constants
65 */
66 
67 // GL_ATI_pn_triangles
68 #ifndef GL_ATI_pn_triangles
69 #define GL_ATI_pn_triangles 1
70 #ifndef __APPLE__		//DAJ BUGFIX changed the numbers
71 #define GL_PN_TRIANGLES_ATI                         0x6090
72 #define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI   0x6091
73 #define GL_PN_TRIANGLES_POINT_MODE_ATI              0x6092
74 #define GL_PN_TRIANGLES_NORMAL_MODE_ATI             0x6093
75 #define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI       0x6094
76 #define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI       0x6095
77 #define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI        0x6096
78 #define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI      0x6097
79 #define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI   0x6098
80 #else
81 #define GL_PN_TRIANGLES_ATI                         0x87F0
82 #define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI   0x87F1
83 #define GL_PN_TRIANGLES_POINT_MODE_ATI              0x87F2
84 #define GL_PN_TRIANGLES_NORMAL_MODE_ATI             0x87F3
85 #define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI       0x87F4
86 #define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI       0x87F5
87 #define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI        0x87F6
88 #define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI      0x87F7
89 #define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI   0x87F8
90 #endif
91 typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC)(GLenum pname, GLint param);
92 typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC)(GLenum pname, GLfloat param);
93 #endif
94 
95 //----(SA)	added
96 extern void (APIENTRYP qglPNTrianglesiATI)(GLenum pname, GLint param);
97 extern void (APIENTRYP qglPNTrianglesfATI)(GLenum pname, GLfloat param);
98 //----(SA)	end
99 
100 // for NV fog distance
101 #ifndef GL_NV_fog_distance
102 #define GL_FOG_DISTANCE_MODE_NV           0x855A
103 #define GL_EYE_RADIAL_NV                  0x855B
104 #define GL_EYE_PLANE_ABSOLUTE_NV          0x855C
105 /* reuse GL_EYE_PLANE */
106 #endif
107 
108 // S3TC compression constants
109 #define GL_RGB_S3TC                         0x83A0
110 #define GL_RGB4_S3TC                        0x83A1
111 
112 // GL_EXT_texture_compression_s3tc constants
113 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                   0x83F0
114 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                  0x83F1
115 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT                  0x83F2
116 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT                  0x83F3
117 
118 // GL_EXT_texture_filter_anisotropic constants
119 #ifndef GL_EXT_texture_filter_anisotropic
120 #define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE
121 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
122 #endif
123 
124 
125 // extensions will be function pointers on all platforms
126 //===========================================================================
127 
128 // GL function loader, based on https://gist.github.com/rygorous/16796a0c876cf8a5f542caddb55bce8a
129 // get missing functions from code/SDL2/include/SDL_opengl.h
130 
131 // OpenGL 1.0/1.1, OpenGL ES 1.0, and OpenGL 3.2 core profile
132 #define QGL_1_1_PROCS \
133 	GLE(void, BindTexture, GLenum target, GLuint texture) \
134 	GLE(void, BlendFunc, GLenum sfactor, GLenum dfactor) \
135 	GLE(void, ClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) \
136 	GLE(void, Clear, GLbitfield mask) \
137 	GLE(void, ClearStencil, GLint s) \
138 	GLE(void, ColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) \
139 	GLE(void, CopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) \
140 	GLE(void, CullFace, GLenum mode) \
141 	GLE(void, DeleteTextures, GLsizei n, const GLuint *textures) \
142 	GLE(void, DepthFunc, GLenum func) \
143 	GLE(void, DepthMask, GLboolean flag) \
144 	GLE(void, Disable, GLenum cap) \
145 	GLE(void, DrawArrays, GLenum mode, GLint first, GLsizei count) \
146 	GLE(void, DrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) \
147 	GLE(void, Enable, GLenum cap) \
148 	GLE(void, Finish, void) \
149 	GLE(void, Flush, void) \
150 	GLE(void, GenTextures, GLsizei n, GLuint *textures ) \
151 	GLE(void, GetBooleanv, GLenum pname, GLboolean *params) \
152 	GLE(GLenum, GetError, void) \
153 	GLE(void, GetIntegerv, GLenum pname, GLint *params) \
154 	GLE(const GLubyte *, GetString, GLenum name) \
155 	GLE(void, LineWidth, GLfloat width) \
156 	GLE(void, PolygonOffset, GLfloat factor, GLfloat units) \
157 	GLE(void, ReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) \
158 	GLE(void, Scissor, GLint x, GLint y, GLsizei width, GLsizei height) \
159 	GLE(void, StencilFunc, GLenum func, GLint ref, GLuint mask) \
160 	GLE(void, StencilMask, GLuint mask) \
161 	GLE(void, StencilOp, GLenum fail, GLenum zfail, GLenum zpass) \
162 	GLE(void, TexImage2D, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) \
163 	GLE(void, TexParameterf, GLenum target, GLenum pname, GLfloat param) \
164 	GLE(void, TexParameteri, GLenum target, GLenum pname, GLint param) \
165 	GLE(void, TexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
166 	GLE(void, Translatef, GLfloat x, GLfloat y, GLfloat z) \
167 	GLE(void, Viewport, GLint x, GLint y, GLsizei width, GLsizei height) \
168 	\
169 	GLE(void, Hint, GLenum target, GLenum mode) /*Added*/ \
170 
171 // OpenGL 1.0/1.1 and OpenGL ES 1.x but not OpenGL 3.2 core profile
172 #define QGL_1_1_FIXED_FUNCTION_PROCS \
173 	GLE(void, AlphaFunc, GLenum func, GLclampf ref) \
174 	GLE(void, Color4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) \
175 	GLE(void, ColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
176 	GLE(void, DisableClientState, GLenum cap) \
177 	GLE(void, EnableClientState, GLenum cap) \
178 	GLE(void, LoadIdentity, void) \
179 	GLE(void, LoadMatrixf, const GLfloat *m) \
180 	GLE(void, MatrixMode, GLenum mode) \
181 	GLE(void, PopMatrix, void) \
182 	GLE(void, PushMatrix, void) \
183 	GLE(void, ShadeModel, GLenum mode) \
184 	GLE(void, TexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
185 	GLE(void, TexEnvf, GLenum target, GLenum pname, GLfloat param) \
186 	GLE(void, VertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) \
187 	\
188 	GLE(void, Fogf, GLenum pname, GLfloat param) /*Added*/ \
189 	GLE(void, Fogfv, GLenum pname, const GLfloat *params) /*Added*/ \
190 	GLE(void, MultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) /*Added*/ \
191 	GLE(void, NormalPointer, GLenum type, GLsizei stride, const GLvoid *ptr) /*Added*/ \
192 
193 // OpenGL 1.0/1.1 and 3.2 core profile but not OpenGL ES 1.x
194 #define QGL_DESKTOP_1_1_PROCS \
195 	GLE(void, ClearDepth, GLclampd depth) \
196 	GLE(void, DepthRange, GLclampd near_val, GLclampd far_val) \
197 	GLE(void, DrawBuffer, GLenum mode) \
198 	GLE(void, PolygonMode, GLenum face, GLenum mode) \
199 
200 // OpenGL 1.0/1.1 but not OpenGL 3.2 core profile or OpenGL ES 1.x
201 #define QGL_DESKTOP_1_1_FIXED_FUNCTION_PROCS \
202 	GLE(void, ArrayElement, GLint i) \
203 	GLE(void, Begin, GLenum mode) \
204 	GLE(void, ClipPlane, GLenum plane, const GLdouble *equation) \
205 	GLE(void, Color3f, GLfloat red, GLfloat green, GLfloat blue) \
206 	GLE(void, Color4ubv, const GLubyte *v) \
207 	GLE(void, End, void) \
208 	GLE(void, Frustum, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) \
209 	GLE(void, Ortho, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) \
210 	GLE(void, TexCoord2f, GLfloat s, GLfloat t) \
211 	GLE(void, TexCoord2fv, const GLfloat *v) \
212 	GLE(void, Vertex2f, GLfloat x, GLfloat y) \
213 	GLE(void, Vertex3f, GLfloat x, GLfloat y, GLfloat z) \
214 	GLE(void, Vertex3fv, const GLfloat *v) \
215 	\
216 	GLE(void, Color3fv, const GLfloat *v) /*Added*/ \
217 	GLE(void, Fogi, GLenum pname, GLint param) /*Added*/ \
218 
219 // OpenGL ES 1.1 and OpenGL ES 2.0 but not desktop OpenGL 1.x
220 #define QGL_ES_1_1_PROCS \
221 	GLE(void, ClearDepthf, GLclampf depth) \
222 	GLE(void, DepthRangef, GLclampf near_val, GLclampf far_val) \
223 
224 // OpenGL ES 1.1 but not OpenGL ES 2.0 or desktop OpenGL 1.x
225 #define QGL_ES_1_1_FIXED_FUNCTION_PROCS \
226 	GLE(void, ClipPlanef, GLenum plane, const GLfloat *equation) \
227 	GLE(void, Frustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near_val, GLfloat far_val) \
228 	GLE(void, Orthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near_val, GLfloat far_val) \
229 
230 // OpenGL 1.3, was GL_ARB_texture_compression
231 #define QGL_1_3_PROCS \
232 	GLE(void, ActiveTexture, GLenum texture) \
233 	GLE(void, CompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data) \
234 	GLE(void, CompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data) \
235 
236 // GL_ARB_occlusion_query, built-in to OpenGL 1.5 but not OpenGL ES 2.0
237 #define QGL_ARB_occlusion_query_PROCS \
238 	GLE(void, GenQueries, GLsizei n, GLuint *ids) \
239 	GLE(void, DeleteQueries, GLsizei n, const GLuint *ids) \
240 	GLE(void, BeginQuery, GLenum target, GLuint id) \
241 	GLE(void, EndQuery, GLenum target) \
242 	GLE(void, GetQueryObjectiv, GLuint id, GLenum pname, GLint *params) \
243 	GLE(void, GetQueryObjectuiv, GLuint id, GLenum pname, GLuint *params) \
244 
245 // OpenGL 1.5, was GL_ARB_vertex_buffer_object
246 #define QGL_1_5_PROCS \
247 	GLE(void, BindBuffer, GLenum target, GLuint buffer) \
248 	GLE(void, DeleteBuffers, GLsizei n, const GLuint *buffers) \
249 	GLE(void, GenBuffers, GLsizei n, GLuint *buffers) \
250 	GLE(void, BufferData, GLenum target, GLsizeiptr size, const void *data, GLenum usage) \
251 	GLE(void, BufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const void *data) \
252 
253 // OpenGL 2.0, was GL_ARB_shading_language_100, GL_ARB_vertex_program, GL_ARB_shader_objects, and GL_ARB_vertex_shader
254 #define QGL_2_0_PROCS \
255 	GLE(void, AttachShader, GLuint program, GLuint shader) \
256 	GLE(void, BindAttribLocation, GLuint program, GLuint index, const GLchar *name) \
257 	GLE(void, CompileShader, GLuint shader) \
258 	GLE(GLuint, CreateProgram, void) \
259 	GLE(GLuint, CreateShader, GLenum type) \
260 	GLE(void, DeleteProgram, GLuint program) \
261 	GLE(void, DeleteShader, GLuint shader) \
262 	GLE(void, DetachShader, GLuint program, GLuint shader) \
263 	GLE(void, DisableVertexAttribArray, GLuint index) \
264 	GLE(void, EnableVertexAttribArray, GLuint index) \
265 	GLE(void, GetActiveUniform, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) \
266 	GLE(void, GetProgramiv, GLuint program, GLenum pname, GLint *params) \
267 	GLE(void, GetProgramInfoLog, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog) \
268 	GLE(void, GetShaderiv, GLuint shader, GLenum pname, GLint *params) \
269 	GLE(void, GetShaderInfoLog, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) \
270 	GLE(void, GetShaderSource, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source) \
271 	GLE(GLint, GetUniformLocation, GLuint program, const GLchar *name) \
272 	GLE(void, LinkProgram, GLuint program) \
273 	GLE(void, ShaderSource, GLuint shader, GLsizei count, const GLchar* *string, const GLint *length) \
274 	GLE(void, UseProgram, GLuint program) \
275 	GLE(void, Uniform1f, GLint location, GLfloat v0) \
276 	GLE(void, Uniform2f, GLint location, GLfloat v0, GLfloat v1) \
277 	GLE(void, Uniform3f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) \
278 	GLE(void, Uniform4f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) \
279 	GLE(void, Uniform1i, GLint location, GLint v0) \
280 	GLE(void, Uniform1fv, GLint location, GLsizei count, const GLfloat *value) \
281 	GLE(void, UniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) \
282 	GLE(void, ValidateProgram, GLuint program) \
283 	GLE(void, VertexAttribPointer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) \
284 
285 // GL_NVX_gpu_memory_info
286 #ifndef GL_NVX_gpu_memory_info
287 #define GL_NVX_gpu_memory_info
288 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX          0x9047
289 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX    0x9048
290 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX  0x9049
291 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX            0x904A
292 #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX            0x904B
293 #endif
294 
295 // GL_ATI_meminfo
296 #ifndef GL_ATI_meminfo
297 #define GL_ATI_meminfo
298 #define GL_VBO_FREE_MEMORY_ATI                    0x87FB
299 #define GL_TEXTURE_FREE_MEMORY_ATI                0x87FC
300 #define GL_RENDERBUFFER_FREE_MEMORY_ATI           0x87FD
301 #endif
302 
303 // GL_ARB_texture_float
304 #ifndef GL_ARB_texture_float
305 #define GL_ARB_texture_float
306 #define GL_TEXTURE_RED_TYPE_ARB             0x8C10
307 #define GL_TEXTURE_GREEN_TYPE_ARB           0x8C11
308 #define GL_TEXTURE_BLUE_TYPE_ARB            0x8C12
309 #define GL_TEXTURE_ALPHA_TYPE_ARB           0x8C13
310 #define GL_TEXTURE_LUMINANCE_TYPE_ARB       0x8C14
311 #define GL_TEXTURE_INTENSITY_TYPE_ARB       0x8C15
312 #define GL_TEXTURE_DEPTH_TYPE_ARB           0x8C16
313 #define GL_UNSIGNED_NORMALIZED_ARB          0x8C17
314 #define GL_RGBA32F_ARB                      0x8814
315 #define GL_RGB32F_ARB                       0x8815
316 #define GL_ALPHA32F_ARB                     0x8816
317 #define GL_INTENSITY32F_ARB                 0x8817
318 #define GL_LUMINANCE32F_ARB                 0x8818
319 #define GL_LUMINANCE_ALPHA32F_ARB           0x8819
320 #define GL_RGBA16F_ARB                      0x881A
321 #define GL_RGB16F_ARB                       0x881B
322 #define GL_ALPHA16F_ARB                     0x881C
323 #define GL_INTENSITY16F_ARB                 0x881D
324 #define GL_LUMINANCE16F_ARB                 0x881E
325 #define GL_LUMINANCE_ALPHA16F_ARB           0x881F
326 #endif
327 
328 #ifndef GL_ARB_half_float_pixel
329 #define GL_ARB_half_float_pixel
330 #define GL_HALF_FLOAT_ARB                   0x140B
331 #endif
332 
333 // OpenGL 3.0 specific
334 #define QGL_3_0_PROCS \
335 	GLE(const GLubyte *, GetStringi, GLenum name, GLuint index) \
336 
337 // GL_ARB_framebuffer_object, built-in to OpenGL 3.0
338 #define QGL_ARB_framebuffer_object_PROCS \
339 	GLE(void, BindRenderbuffer, GLenum target, GLuint renderbuffer) \
340 	GLE(void, DeleteRenderbuffers, GLsizei n, const GLuint *renderbuffers) \
341 	GLE(void, GenRenderbuffers, GLsizei n, GLuint *renderbuffers) \
342 	GLE(void, RenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) \
343 	GLE(void, BindFramebuffer, GLenum target, GLuint framebuffer) \
344 	GLE(void, DeleteFramebuffers, GLsizei n, const GLuint *framebuffers) \
345 	GLE(void, GenFramebuffers, GLsizei n, GLuint *framebuffers) \
346 	GLE(GLenum, CheckFramebufferStatus, GLenum target) \
347 	GLE(void, FramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) \
348 	GLE(void, FramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) \
349 	GLE(void, GenerateMipmap, GLenum target) \
350 	GLE(void, BlitFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) \
351 	GLE(void, RenderbufferStorageMultisample, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) \
352 
353 // GL_ARB_vertex_array_object, built-in to OpenGL 3.0
354 #define QGL_ARB_vertex_array_object_PROCS \
355 	GLE(void, BindVertexArray, GLuint array) \
356 	GLE(void, DeleteVertexArrays, GLsizei n, const GLuint *arrays) \
357 	GLE(void, GenVertexArrays, GLsizei n, GLuint *arrays) \
358 
359 #ifndef GL_ARB_texture_compression_rgtc
360 #define GL_ARB_texture_compression_rgtc
361 #define GL_COMPRESSED_RED_RGTC1                       0x8DBB
362 #define GL_COMPRESSED_SIGNED_RED_RGTC1                0x8DBC
363 #define GL_COMPRESSED_RG_RGTC2                        0x8DBD
364 #define GL_COMPRESSED_SIGNED_RG_RGTC2                 0x8DBE
365 #endif
366 
367 #ifndef GL_ARB_texture_compression_bptc
368 #define GL_ARB_texture_compression_bptc
369 #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB                 0x8E8C
370 #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB           0x8E8D
371 #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB           0x8E8E
372 #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB         0x8E8F
373 #endif
374 
375 #ifndef GL_ARB_depth_clamp
376 #define GL_ARB_depth_clamp
377 #define GL_DEPTH_CLAMP				      0x864F
378 #endif
379 
380 #ifndef GL_ARB_seamless_cube_map
381 #define GL_ARB_seamless_cube_map
382 #define GL_TEXTURE_CUBE_MAP_SEAMLESS               0x884F
383 #endif
384 
385 // GL_EXT_direct_state_access
386 #define QGL_EXT_direct_state_access_PROCS \
387 	GLE(GLvoid, BindMultiTextureEXT, GLenum texunit, GLenum target, GLuint texture) \
388 	GLE(GLvoid, TextureParameterfEXT, GLuint texture, GLenum target, GLenum pname, GLfloat param) \
389 	GLE(GLvoid, TextureParameteriEXT, GLuint texture, GLenum target, GLenum pname, GLint param) \
390 	GLE(GLvoid, TextureImage2DEXT, GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) \
391 	GLE(GLvoid, TextureSubImage2DEXT, GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) \
392 	GLE(GLvoid, CopyTextureSubImage2DEXT, GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) \
393 	GLE(GLvoid, CompressedTextureImage2DEXT, GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) \
394 	GLE(GLvoid, CompressedTextureSubImage2DEXT, GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) \
395 	GLE(GLvoid, GenerateTextureMipmapEXT, GLuint texture, GLenum target) \
396 	GLE(GLvoid, ProgramUniform1iEXT, GLuint program, GLint location, GLint v0) \
397 	GLE(GLvoid, ProgramUniform1fEXT, GLuint program, GLint location, GLfloat v0) \
398 	GLE(GLvoid, ProgramUniform2fEXT, GLuint program, GLint location, GLfloat v0, GLfloat v1) \
399 	GLE(GLvoid, ProgramUniform3fEXT, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) \
400 	GLE(GLvoid, ProgramUniform4fEXT, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) \
401 	GLE(GLvoid, ProgramUniform1fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value) \
402 	GLE(GLvoid, ProgramUniformMatrix4fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) \
403 	GLE(GLvoid, NamedRenderbufferStorageEXT, GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height) \
404 	GLE(GLvoid, NamedRenderbufferStorageMultisampleEXT, GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) \
405 	GLE(GLenum, CheckNamedFramebufferStatusEXT, GLuint framebuffer, GLenum target) \
406 	GLE(GLvoid, NamedFramebufferTexture2DEXT, GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level) \
407 	GLE(GLvoid, NamedFramebufferRenderbufferEXT, GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) \
408 
409 #define GLE(ret, name, ...) typedef ret APIENTRY name##proc(__VA_ARGS__);
410 QGL_1_1_PROCS;
411 QGL_1_1_FIXED_FUNCTION_PROCS;
412 QGL_DESKTOP_1_1_PROCS;
413 QGL_DESKTOP_1_1_FIXED_FUNCTION_PROCS;
414 QGL_ES_1_1_PROCS;
415 QGL_ES_1_1_FIXED_FUNCTION_PROCS;
416 QGL_1_3_PROCS;
417 QGL_1_5_PROCS;
418 QGL_2_0_PROCS;
419 QGL_3_0_PROCS;
420 QGL_ARB_occlusion_query_PROCS;
421 QGL_ARB_framebuffer_object_PROCS;
422 QGL_ARB_vertex_array_object_PROCS;
423 QGL_EXT_direct_state_access_PROCS;
424 #undef GLE
425 
426 extern int qglMajorVersion, qglMinorVersion;
427 extern int qglesMajorVersion, qglesMinorVersion;
428 #define QGL_VERSION_ATLEAST( major, minor ) ( qglMajorVersion > major || ( qglMajorVersion == major && qglMinorVersion >= minor ) )
429 #define QGLES_VERSION_ATLEAST( major, minor ) ( qglesMajorVersion > major || ( qglesMajorVersion == major && qglesMinorVersion >= minor ) )
430 
431 #endif // __QGL_H__
432