changed PF_WARNING to not do a return
[divverent/darkplaces.git] / glquake.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20
21 #ifndef GLQUAKE_H
22 #define GLQUAKE_H
23
24 // disable data conversion warnings
25
26 #ifdef _MSC_VER
27 #pragma warning(disable : 4244)     // LordHavoc: MSVC++ 4 x86, double/float
28 #pragma warning(disable : 4305)         // LordHavoc: MSVC++ 6 x86, double/float
29 #endif
30
31
32 //====================================================
33
34 // wgl uses APIENTRY
35 #ifndef APIENTRY
36 #define APIENTRY
37 #endif
38
39 // for platforms (wgl) that do not use GLAPIENTRY
40 #ifndef GLAPIENTRY
41 #define GLAPIENTRY APIENTRY
42 #endif
43
44 #ifndef GL_PROJECTION
45 typedef unsigned int GLenum;
46 typedef unsigned char GLboolean;
47 typedef unsigned int GLbitfield;
48 typedef void GLvoid;
49 // 1-byte signed
50 typedef signed char GLbyte;
51 // 2-byte signed
52 typedef short GLshort;
53 // 4-byte signed
54 typedef int GLint;
55 // 1-byte unsigned
56 typedef unsigned char GLubyte;
57 // 2-byte unsigned
58 typedef unsigned short GLushort;
59 // 4-byte unsigned
60 typedef unsigned int GLuint;
61 // 4-byte signed
62 typedef int GLsizei;
63 // single precision float
64 typedef float GLfloat;
65 // single precision float in [0,1]
66 typedef float GLclampf;
67 // double precision float
68 typedef double GLdouble;
69 // double precision float in [0,1]
70 typedef double GLclampd;
71
72 #define GL_MODELVIEW                            0x1700
73 #define GL_PROJECTION                           0x1701
74 #define GL_TEXTURE                              0x1702
75 #define GL_MATRIX_MODE                          0x0BA0
76 #define GL_MODELVIEW_MATRIX                     0x0BA6
77 #define GL_PROJECTION_MATRIX                    0x0BA7
78 #define GL_TEXTURE_MATRIX                       0x0BA8
79
80 #define GL_DEPTH_TEST                           0x0B71
81
82 #define GL_CULL_FACE                            0x0B44
83
84 #define GL_BLEND                                0x0BE2
85 #define GL_ALPHA_TEST                   0x0BC0
86
87 #define GL_ZERO                                 0x0
88 #define GL_ONE                                  0x1
89 #define GL_SRC_COLOR                            0x0300
90 #define GL_ONE_MINUS_SRC_COLOR                  0x0301
91 #define GL_DST_COLOR                            0x0306
92 #define GL_ONE_MINUS_DST_COLOR                  0x0307
93 #define GL_SRC_ALPHA                            0x0302
94 #define GL_ONE_MINUS_SRC_ALPHA                  0x0303
95 #define GL_DST_ALPHA                            0x0304
96 #define GL_ONE_MINUS_DST_ALPHA                  0x0305
97 #define GL_SRC_ALPHA_SATURATE                   0x0308
98 #define GL_CONSTANT_COLOR                       0x8001
99 #define GL_ONE_MINUS_CONSTANT_COLOR             0x8002
100 #define GL_CONSTANT_ALPHA                       0x8003
101 #define GL_ONE_MINUS_CONSTANT_ALPHA             0x8004
102
103 #define GL_TEXTURE_ENV                          0x2300
104 #define GL_TEXTURE_ENV_MODE                     0x2200
105 #define GL_TEXTURE_1D                           0x0DE0
106 #define GL_TEXTURE_2D                           0x0DE1
107 #define GL_TEXTURE_WRAP_S                       0x2802
108 #define GL_TEXTURE_WRAP_T                       0x2803
109 #define GL_TEXTURE_WRAP_R                       0x8072
110 #define GL_TEXTURE_BORDER_COLOR                 0x1004
111 #define GL_TEXTURE_MAG_FILTER                   0x2800
112 #define GL_TEXTURE_MIN_FILTER                   0x2801
113 #define GL_UNPACK_ALIGNMENT                     0x0CF5
114 #define GL_TEXTURE_BINDING_1D                   0x8068
115 #define GL_TEXTURE_BINDING_2D                   0x8069
116
117 #define GL_NEAREST                              0x2600
118 #define GL_LINEAR                               0x2601
119 #define GL_NEAREST_MIPMAP_NEAREST               0x2700
120 #define GL_NEAREST_MIPMAP_LINEAR                0x2702
121 #define GL_LINEAR_MIPMAP_NEAREST                0x2701
122 #define GL_LINEAR_MIPMAP_LINEAR                 0x2703
123
124 #define GL_LINE                                 0x1B01
125 #define GL_FILL                                 0x1B02
126
127 extern int gl_support_anisotropy;
128 extern int gl_max_anisotropy;
129 #define GL_TEXTURE_MAX_ANISOTROPY_EXT           0x84FE
130 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT       0x84FF
131
132 #define GL_ADD                                  0x0104
133 #define GL_DECAL                                0x2101
134 #define GL_MODULATE                             0x2100
135
136 #define GL_REPEAT                               0x2901
137 #define GL_CLAMP                                0x2900
138
139 #define GL_POINTS                               0x0000
140 #define GL_LINES                                0x0001
141 #define GL_LINE_LOOP                    0x0002
142 #define GL_LINE_STRIP                   0x0003
143 #define GL_TRIANGLES                    0x0004
144 #define GL_TRIANGLE_STRIP               0x0005
145 #define GL_TRIANGLE_FAN                 0x0006
146 #define GL_QUADS                                0x0007
147 #define GL_QUAD_STRIP                   0x0008
148 #define GL_POLYGON                              0x0009
149
150 #define GL_FALSE                                0x0
151 #define GL_TRUE                                 0x1
152
153 #define GL_BYTE                                 0x1400
154 #define GL_UNSIGNED_BYTE                        0x1401
155 #define GL_SHORT                                0x1402
156 #define GL_UNSIGNED_SHORT                       0x1403
157 #define GL_INT                                  0x1404
158 #define GL_UNSIGNED_INT                         0x1405
159 #define GL_FLOAT                                0x1406
160 #define GL_DOUBLE                               0x140A
161 #define GL_2_BYTES                              0x1407
162 #define GL_3_BYTES                              0x1408
163 #define GL_4_BYTES                              0x1409
164
165 #define GL_VERTEX_ARRAY                         0x8074
166 #define GL_NORMAL_ARRAY                         0x8075
167 #define GL_COLOR_ARRAY                          0x8076
168 //#define GL_INDEX_ARRAY                                0x8077
169 #define GL_TEXTURE_COORD_ARRAY                  0x8078
170 //#define GL_EDGE_FLAG_ARRAY                    0x8079
171
172 #define GL_FRONT                                0x0404
173 #define GL_BACK                                 0x0405
174
175 #define GL_VENDOR                               0x1F00
176 #define GL_RENDERER                             0x1F01
177 #define GL_VERSION                              0x1F02
178 #define GL_EXTENSIONS                           0x1F03
179
180 #define GL_NO_ERROR                             0x0
181 #define GL_INVALID_VALUE                        0x0501
182 #define GL_INVALID_ENUM                         0x0500
183 #define GL_INVALID_OPERATION                    0x0502
184 #define GL_STACK_OVERFLOW                       0x0503
185 #define GL_STACK_UNDERFLOW                      0x0504
186 #define GL_OUT_OF_MEMORY                        0x0505
187
188 #define GL_DITHER                               0x0BD0
189 #define GL_RGB                                  0x1907
190 #define GL_RGBA                                 0x1908
191
192 #define GL_MAX_TEXTURE_SIZE                     0x0D33
193
194 #define GL_NEVER                                0x0200
195 #define GL_LESS                                 0x0201
196 #define GL_EQUAL                                0x0202
197 #define GL_LEQUAL                               0x0203
198 #define GL_GREATER                              0x0204
199 #define GL_NOTEQUAL                             0x0205
200 #define GL_GEQUAL                               0x0206
201 #define GL_ALWAYS                               0x0207
202 #define GL_DEPTH_TEST                           0x0B71
203
204 #define GL_RED_SCALE                            0x0D14
205 #define GL_GREEN_SCALE                          0x0D18
206 #define GL_BLUE_SCALE                           0x0D1A
207 #define GL_ALPHA_SCALE                          0x0D1C
208
209 #define GL_DEPTH_BUFFER_BIT                     0x00000100
210 #define GL_ACCUM_BUFFER_BIT                     0x00000200
211 #define GL_STENCIL_BUFFER_BIT                   0x00000400
212 #define GL_COLOR_BUFFER_BIT                     0x00004000
213
214 #define GL_STENCIL_TEST                         0x0B90
215 #define GL_KEEP                                 0x1E00
216 #define GL_REPLACE                              0x1E01
217 #define GL_INCR                                 0x1E02
218 #define GL_DECR                                 0x1E03
219
220 #define GL_POLYGON_OFFSET_FACTOR          0x8038
221 #define GL_POLYGON_OFFSET_UNITS           0x2A00
222 #define GL_POLYGON_OFFSET_POINT           0x2A01
223 #define GL_POLYGON_OFFSET_LINE            0x2A02
224 #define GL_POLYGON_OFFSET_FILL            0x8037
225
226 #define GL_POINT_SMOOTH                         0x0B10
227 #define GL_LINE_SMOOTH                          0x0B20
228 #define GL_POLYGON_SMOOTH                       0x0B41
229 #endif
230
231 extern int gl_max_texture_size;
232
233 // GL_ARB_multitexture
234 extern int gl_textureunits;
235 extern void (GLAPIENTRY *qglMultiTexCoord1f) (GLenum, GLfloat);
236 extern void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
237 extern void (GLAPIENTRY *qglMultiTexCoord3f) (GLenum, GLfloat, GLfloat, GLfloat);
238 extern void (GLAPIENTRY *qglMultiTexCoord4f) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
239 extern void (GLAPIENTRY *qglActiveTexture) (GLenum);
240 extern void (GLAPIENTRY *qglClientActiveTexture) (GLenum);
241 #ifndef GL_ACTIVE_TEXTURE_ARB
242 #define GL_ACTIVE_TEXTURE_ARB                   0x84E0
243 #define GL_CLIENT_ACTIVE_TEXTURE_ARB    0x84E1
244 #define GL_MAX_TEXTURE_UNITS_ARB                0x84E2
245 #define GL_TEXTURE0_ARB                                 0x84C0
246 #define GL_TEXTURE1_ARB                                 0x84C1
247 #define GL_TEXTURE2_ARB                                 0x84C2
248 #define GL_TEXTURE3_ARB                                 0x84C3
249 #define GL_TEXTURE4_ARB                                 0x84C4
250 #define GL_TEXTURE5_ARB                                 0x84C5
251 #define GL_TEXTURE6_ARB                                 0x84C6
252 #define GL_TEXTURE7_ARB                                 0x84C7
253 #define GL_TEXTURE8_ARB                                 0x84C8
254 #define GL_TEXTURE9_ARB                                 0x84C9
255 #define GL_TEXTURE10_ARB                                0x84CA
256 #define GL_TEXTURE11_ARB                                0x84CB
257 #define GL_TEXTURE12_ARB                                0x84CC
258 #define GL_TEXTURE13_ARB                                0x84CD
259 #define GL_TEXTURE14_ARB                                0x84CE
260 #define GL_TEXTURE15_ARB                                0x84CF
261 #define GL_TEXTURE16_ARB                                0x84D0
262 #define GL_TEXTURE17_ARB                                0x84D1
263 #define GL_TEXTURE18_ARB                                0x84D2
264 #define GL_TEXTURE19_ARB                                0x84D3
265 #define GL_TEXTURE20_ARB                                0x84D4
266 #define GL_TEXTURE21_ARB                                0x84D5
267 #define GL_TEXTURE22_ARB                                0x84D6
268 #define GL_TEXTURE23_ARB                                0x84D7
269 #define GL_TEXTURE24_ARB                                0x84D8
270 #define GL_TEXTURE25_ARB                                0x84D9
271 #define GL_TEXTURE26_ARB                                0x84DA
272 #define GL_TEXTURE27_ARB                                0x84DB
273 #define GL_TEXTURE28_ARB                                0x84DC
274 #define GL_TEXTURE29_ARB                                0x84DD
275 #define GL_TEXTURE30_ARB                                0x84DE
276 #define GL_TEXTURE31_ARB                                0x84DF
277 #endif
278
279 // GL_EXT_compiled_vertex_array
280 extern int gl_supportslockarrays;
281 extern void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
282 extern void (GLAPIENTRY *qglUnlockArraysEXT) (void);
283
284 // GL_ARB_texture_env_combine
285 extern int gl_combine_extension;
286 #ifndef GL_COMBINE_ARB
287 #define GL_COMBINE_ARB                                  0x8570
288 #define GL_COMBINE_RGB_ARB                              0x8571
289 #define GL_COMBINE_ALPHA_ARB                    0x8572
290 #define GL_SOURCE0_RGB_ARB                              0x8580
291 #define GL_SOURCE1_RGB_ARB                              0x8581
292 #define GL_SOURCE2_RGB_ARB                              0x8582
293 #define GL_SOURCE0_ALPHA_ARB                    0x8588
294 #define GL_SOURCE1_ALPHA_ARB                    0x8589
295 #define GL_SOURCE2_ALPHA_ARB                    0x858A
296 #define GL_OPERAND0_RGB_ARB                             0x8590
297 #define GL_OPERAND1_RGB_ARB                             0x8591
298 #define GL_OPERAND2_RGB_ARB                             0x8592
299 #define GL_OPERAND0_ALPHA_ARB                   0x8598
300 #define GL_OPERAND1_ALPHA_ARB                   0x8599
301 #define GL_OPERAND2_ALPHA_ARB                   0x859A
302 #define GL_RGB_SCALE_ARB                                0x8573
303 #define GL_ADD_SIGNED_ARB                               0x8574
304 #define GL_INTERPOLATE_ARB                              0x8575
305 #define GL_SUBTRACT_ARB                                 0x84E7
306 #define GL_CONSTANT_ARB                                 0x8576
307 #define GL_PRIMARY_COLOR_ARB                    0x8577
308 #define GL_PREVIOUS_ARB                                 0x8578
309 #endif
310
311 #ifndef GL_MAX_ELEMENTS_VERTICES
312 #define GL_MAX_ELEMENTS_VERTICES                0x80E8
313 #endif
314 #ifndef GL_MAX_ELEMENTS_INDICES
315 #define GL_MAX_ELEMENTS_INDICES                 0x80E9
316 #endif
317
318
319 extern int gl_texture3d;
320 extern int gl_max_3d_texture_size;
321 #ifndef GL_TEXTURE_3D
322 #define GL_PACK_SKIP_IMAGES                     0x806B
323 #define GL_PACK_IMAGE_HEIGHT                    0x806C
324 #define GL_UNPACK_SKIP_IMAGES                   0x806D
325 #define GL_UNPACK_IMAGE_HEIGHT                  0x806E
326 #define GL_TEXTURE_3D                           0x806F
327 #define GL_PROXY_TEXTURE_3D                     0x8070
328 #define GL_TEXTURE_DEPTH                        0x8071
329 #define GL_TEXTURE_WRAP_R                       0x8072
330 #define GL_MAX_3D_TEXTURE_SIZE                  0x8073
331 #define GL_TEXTURE_BINDING_3D                   0x806A
332 extern void (GLAPIENTRY *qglTexImage3D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
333 extern void (GLAPIENTRY *qglTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
334 extern void (GLAPIENTRY *qglCopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
335 #endif
336
337 extern int gl_texturecubemap;
338 extern int gl_max_cube_map_texture_size;
339 #ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
340 #define GL_NORMAL_MAP_ARB                           0x8511
341 #define GL_REFLECTION_MAP_ARB               0x8512
342 #define GL_TEXTURE_CUBE_MAP_ARB             0x8513
343 #define GL_TEXTURE_BINDING_CUBE_MAP_ARB     0x8514
344 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB     0x8515
345 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB     0x8516
346 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB     0x8517
347 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB     0x8518
348 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB     0x8519
349 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB     0x851A
350 #define GL_PROXY_TEXTURE_CUBE_MAP_ARB       0x851B
351 #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB                0x851C
352 #endif
353
354 extern int gl_dot3arb;
355 #ifndef GL_DOT3_RGB_ARB
356 #define GL_DOT3_RGB_ARB                         0x86AE
357 #define GL_DOT3_RGBA_ARB                                0x86AF
358 #endif
359
360 /*
361 // uncomment if this is actually needed by anyone
362 extern int gl_dot3ext;
363 #ifndef GL_DOT3_RGB_EXT
364 #define GL_DOT3_RGB_EXT                         0x8740
365 #define GL_DOT3_RGBA_EXT                        0x8741
366 #endif
367 */
368
369 #ifndef GL_SCISSOR_TEST
370 #define GL_SCISSOR_TEST                         0x0C11
371 #define GL_SCISSOR_BOX                          0x0C10
372 #endif
373
374 // GL_SGIS_texture_edge_clamp or GL_EXT_texture_edge_clamp
375 extern int gl_support_clamptoedge;
376 #ifndef GL_CLAMP_TO_EDGE
377 #define GL_CLAMP_TO_EDGE 0x812F
378 #endif
379
380 //GL_EXT_stencil_two_side
381 #define GL_STENCIL_TEST_TWO_SIDE_EXT      0x8910
382 #define GL_ACTIVE_STENCIL_FACE_EXT        0x8911
383 extern void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum);
384 extern int gl_support_stenciltwoside;
385
386 extern void (GLAPIENTRY *qglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
387
388 extern void (GLAPIENTRY *qglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
389
390 extern void (GLAPIENTRY *qglClear)(GLbitfield mask);
391
392 extern void (GLAPIENTRY *qglAlphaFunc)(GLenum func, GLclampf ref);
393 extern void (GLAPIENTRY *qglBlendFunc)(GLenum sfactor, GLenum dfactor);
394 extern void (GLAPIENTRY *qglCullFace)(GLenum mode);
395
396 extern void (GLAPIENTRY *qglDrawBuffer)(GLenum mode);
397 extern void (GLAPIENTRY *qglReadBuffer)(GLenum mode);
398 extern void (GLAPIENTRY *qglEnable)(GLenum cap);
399 extern void (GLAPIENTRY *qglDisable)(GLenum cap);
400 extern GLboolean (GLAPIENTRY *qglIsEnabled)(GLenum cap);
401
402 extern void (GLAPIENTRY *qglEnableClientState)(GLenum cap);
403 extern void (GLAPIENTRY *qglDisableClientState)(GLenum cap);
404
405 extern void (GLAPIENTRY *qglGetBooleanv)(GLenum pname, GLboolean *params);
406 extern void (GLAPIENTRY *qglGetDoublev)(GLenum pname, GLdouble *params);
407 extern void (GLAPIENTRY *qglGetFloatv)(GLenum pname, GLfloat *params);
408 extern void (GLAPIENTRY *qglGetIntegerv)(GLenum pname, GLint *params);
409
410 extern GLenum (GLAPIENTRY *qglGetError)(void);
411 extern const GLubyte* (GLAPIENTRY *qglGetString)(GLenum name);
412 extern void (GLAPIENTRY *qglFinish)(void);
413 extern void (GLAPIENTRY *qglFlush)(void);
414
415 extern void (GLAPIENTRY *qglClearDepth)(GLclampd depth);
416 extern void (GLAPIENTRY *qglDepthFunc)(GLenum func);
417 extern void (GLAPIENTRY *qglDepthMask)(GLboolean flag);
418 extern void (GLAPIENTRY *qglDepthRange)(GLclampd near_val, GLclampd far_val);
419 extern void (GLAPIENTRY *qglColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
420
421 extern void (GLAPIENTRY *qglDrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
422 extern void (GLAPIENTRY *qglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
423 extern void (GLAPIENTRY *qglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
424 extern void (GLAPIENTRY *qglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *ptr);
425 extern void (GLAPIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
426 extern void (GLAPIENTRY *qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
427 extern void (GLAPIENTRY *qglArrayElement)(GLint i);
428
429 extern void (GLAPIENTRY *qglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
430 extern void (GLAPIENTRY *qglTexCoord1f)(GLfloat s);
431 extern void (GLAPIENTRY *qglTexCoord2f)(GLfloat s, GLfloat t);
432 extern void (GLAPIENTRY *qglTexCoord3f)(GLfloat s, GLfloat t, GLfloat r);
433 extern void (GLAPIENTRY *qglTexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
434 extern void (GLAPIENTRY *qglVertex2f)(GLfloat x, GLfloat y);
435 extern void (GLAPIENTRY *qglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
436 extern void (GLAPIENTRY *qglBegin)(GLenum mode);
437 extern void (GLAPIENTRY *qglEnd)(void);
438
439 extern void (GLAPIENTRY *qglMatrixMode)(GLenum mode);
440 extern void (GLAPIENTRY *qglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
441 extern void (GLAPIENTRY *qglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
442 extern void (GLAPIENTRY *qglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
443 extern void (GLAPIENTRY *qglPushMatrix)(void);
444 extern void (GLAPIENTRY *qglPopMatrix)(void);
445 extern void (GLAPIENTRY *qglLoadIdentity)(void);
446 extern void (GLAPIENTRY *qglLoadMatrixd)(const GLdouble *m);
447 extern void (GLAPIENTRY *qglLoadMatrixf)(const GLfloat *m);
448 extern void (GLAPIENTRY *qglMultMatrixd)(const GLdouble *m);
449 extern void (GLAPIENTRY *qglMultMatrixf)(const GLfloat *m);
450 extern void (GLAPIENTRY *qglRotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
451 extern void (GLAPIENTRY *qglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
452 extern void (GLAPIENTRY *qglScaled)(GLdouble x, GLdouble y, GLdouble z);
453 extern void (GLAPIENTRY *qglScalef)(GLfloat x, GLfloat y, GLfloat z);
454 extern void (GLAPIENTRY *qglTranslated)(GLdouble x, GLdouble y, GLdouble z);
455 extern void (GLAPIENTRY *qglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
456
457 extern void (GLAPIENTRY *qglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
458
459 extern void (GLAPIENTRY *qglStencilFunc)(GLenum func, GLint ref, GLuint mask);
460 extern void (GLAPIENTRY *qglStencilMask)(GLuint mask);
461 extern void (GLAPIENTRY *qglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
462 extern void (GLAPIENTRY *qglClearStencil)(GLint s);
463
464 extern void (GLAPIENTRY *qglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
465 extern void (GLAPIENTRY *qglTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params);
466 extern void (GLAPIENTRY *qglTexEnvi)(GLenum target, GLenum pname, GLint param);
467 extern void (GLAPIENTRY *qglTexParameterf)(GLenum target, GLenum pname, GLfloat param);
468 extern void (GLAPIENTRY *qglTexParameterfv)(GLenum target, GLenum pname, GLfloat *params);
469 extern void (GLAPIENTRY *qglTexParameteri)(GLenum target, GLenum pname, GLint param);
470
471 extern void (GLAPIENTRY *qglGenTextures)(GLsizei n, GLuint *textures);
472 extern void (GLAPIENTRY *qglDeleteTextures)(GLsizei n, const GLuint *textures);
473 extern void (GLAPIENTRY *qglBindTexture)(GLenum target, GLuint texture);
474 //extern void (GLAPIENTRY *qglPrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities);
475 //extern GLboolean (GLAPIENTRY *qglAreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences);
476 extern GLboolean (GLAPIENTRY *qglIsTexture)(GLuint texture);
477 extern void (GLAPIENTRY *qglPixelStoref)(GLenum pname, GLfloat param);
478 extern void (GLAPIENTRY *qglPixelStorei)(GLenum pname, GLint param);
479
480 extern void (GLAPIENTRY *qglTexImage1D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
481 extern void (GLAPIENTRY *qglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
482 extern void (GLAPIENTRY *qglTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
483 extern void (GLAPIENTRY *qglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
484 extern void (GLAPIENTRY *qglCopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
485 extern void (GLAPIENTRY *qglCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
486 extern void (GLAPIENTRY *qglCopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
487 extern void (GLAPIENTRY *qglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
488
489 extern void (GLAPIENTRY *qglPolygonOffset)(GLfloat factor, GLfloat units);
490 extern void (GLAPIENTRY *qglPolygonMode)(GLenum face, GLenum mode);
491
492 //[515]: added on 29.07.2005
493 extern void (GLAPIENTRY *qglLineWidth)(GLfloat width);
494 extern void (GLAPIENTRY *qglPointSize)(GLfloat size);
495
496 // GL_ARB_shader_objects
497 extern int gl_support_shader_objects;
498 #ifndef GL_PROGRAM_OBJECT_ARB
499 // 1-byte character string
500 typedef char GLcharARB;
501 // 4-byte integer handle to a shader object or program object
502 typedef int GLhandleARB;
503 #endif
504 extern void (GLAPIENTRY *qglDeleteObjectARB)(GLhandleARB obj);
505 extern GLhandleARB (GLAPIENTRY *qglGetHandleARB)(GLenum pname);
506 extern void (GLAPIENTRY *qglDetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj);
507 extern GLhandleARB (GLAPIENTRY *qglCreateShaderObjectARB)(GLenum shaderType);
508 extern void (GLAPIENTRY *qglShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
509 extern void (GLAPIENTRY *qglCompileShaderARB)(GLhandleARB shaderObj);
510 extern GLhandleARB (GLAPIENTRY *qglCreateProgramObjectARB)(void);
511 extern void (GLAPIENTRY *qglAttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj);
512 extern void (GLAPIENTRY *qglLinkProgramARB)(GLhandleARB programObj);
513 extern void (GLAPIENTRY *qglUseProgramObjectARB)(GLhandleARB programObj);
514 extern void (GLAPIENTRY *qglValidateProgramARB)(GLhandleARB programObj);
515 extern void (GLAPIENTRY *qglUniform1fARB)(GLint location, GLfloat v0);
516 extern void (GLAPIENTRY *qglUniform2fARB)(GLint location, GLfloat v0, GLfloat v1);
517 extern void (GLAPIENTRY *qglUniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
518 extern void (GLAPIENTRY *qglUniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
519 extern void (GLAPIENTRY *qglUniform1iARB)(GLint location, GLint v0);
520 extern void (GLAPIENTRY *qglUniform2iARB)(GLint location, GLint v0, GLint v1);
521 extern void (GLAPIENTRY *qglUniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2);
522 extern void (GLAPIENTRY *qglUniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
523 extern void (GLAPIENTRY *qglUniform1fvARB)(GLint location, GLsizei count, const GLfloat *value);
524 extern void (GLAPIENTRY *qglUniform2fvARB)(GLint location, GLsizei count, const GLfloat *value);
525 extern void (GLAPIENTRY *qglUniform3fvARB)(GLint location, GLsizei count, const GLfloat *value);
526 extern void (GLAPIENTRY *qglUniform4fvARB)(GLint location, GLsizei count, const GLfloat *value);
527 extern void (GLAPIENTRY *qglUniform1ivARB)(GLint location, GLsizei count, const GLint *value);
528 extern void (GLAPIENTRY *qglUniform2ivARB)(GLint location, GLsizei count, const GLint *value);
529 extern void (GLAPIENTRY *qglUniform3ivARB)(GLint location, GLsizei count, const GLint *value);
530 extern void (GLAPIENTRY *qglUniform4ivARB)(GLint location, GLsizei count, const GLint *value);
531 extern void (GLAPIENTRY *qglUniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
532 extern void (GLAPIENTRY *qglUniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
533 extern void (GLAPIENTRY *qglUniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
534 extern void (GLAPIENTRY *qglGetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat *params);
535 extern void (GLAPIENTRY *qglGetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint *params);
536 extern void (GLAPIENTRY *qglGetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
537 extern void (GLAPIENTRY *qglGetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
538 extern GLint (GLAPIENTRY *qglGetUniformLocationARB)(GLhandleARB programObj, const GLcharARB *name);
539 extern void (GLAPIENTRY *qglGetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
540 extern void (GLAPIENTRY *qglGetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat *params);
541 extern void (GLAPIENTRY *qglGetUniformivARB)(GLhandleARB programObj, GLint location, GLint *params);
542 extern void (GLAPIENTRY *qglGetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
543 #ifndef GL_PROGRAM_OBJECT_ARB
544 #define GL_PROGRAM_OBJECT_ARB                                   0x8B40
545 #define GL_OBJECT_TYPE_ARB                                              0x8B4E
546 #define GL_OBJECT_SUBTYPE_ARB                                   0x8B4F
547 #define GL_OBJECT_DELETE_STATUS_ARB                             0x8B80
548 #define GL_OBJECT_COMPILE_STATUS_ARB                    0x8B81
549 #define GL_OBJECT_LINK_STATUS_ARB                               0x8B82
550 #define GL_OBJECT_VALIDATE_STATUS_ARB                   0x8B83
551 #define GL_OBJECT_INFO_LOG_LENGTH_ARB                   0x8B84
552 #define GL_OBJECT_ATTACHED_OBJECTS_ARB                  0x8B85
553 #define GL_OBJECT_ACTIVE_UNIFORMS_ARB                   0x8B86
554 #define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
555 #define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB              0x8B88
556 #define GL_SHADER_OBJECT_ARB                                    0x8B48
557 #define GL_FLOAT                                                                0x1406
558 #define GL_FLOAT_VEC2_ARB                                               0x8B50
559 #define GL_FLOAT_VEC3_ARB                                               0x8B51
560 #define GL_FLOAT_VEC4_ARB                                               0x8B52
561 #define GL_INT                                                                  0x1404
562 #define GL_INT_VEC2_ARB                                                 0x8B53
563 #define GL_INT_VEC3_ARB                                                 0x8B54
564 #define GL_INT_VEC4_ARB                                                 0x8B55
565 #define GL_BOOL_ARB                                                             0x8B56
566 #define GL_BOOL_VEC2_ARB                                                0x8B57
567 #define GL_BOOL_VEC3_ARB                                                0x8B58
568 #define GL_BOOL_VEC4_ARB                                                0x8B59
569 #define GL_FLOAT_MAT2_ARB                                               0x8B5A
570 #define GL_FLOAT_MAT3_ARB                                               0x8B5B
571 #define GL_FLOAT_MAT4_ARB                                               0x8B5C
572 #define GL_SAMPLER_1D_ARB                                               0x8B5D
573 #define GL_SAMPLER_2D_ARB                                               0x8B5E
574 #define GL_SAMPLER_3D_ARB                                               0x8B5F
575 #define GL_SAMPLER_CUBE_ARB                                             0x8B60
576 #define GL_SAMPLER_1D_SHADOW_ARB                                0x8B61
577 #define GL_SAMPLER_2D_SHADOW_ARB                                0x8B62
578 #define GL_SAMPLER_2D_RECT_ARB                                  0x8B63
579 #define GL_SAMPLER_2D_RECT_SHADOW_ARB                   0x8B64
580 #endif
581
582 // GL_ARB_vertex_shader
583 extern int gl_support_vertex_shader;
584 //extern void (GLAPIENTRY *qglVertexAttrib1fARB)(GLuint index, GLfloat v0);
585 //extern void (GLAPIENTRY *qglVertexAttrib1sARB)(GLuint index, GLshort v0);
586 //extern void (GLAPIENTRY *qglVertexAttrib1dARB)(GLuint index, GLdouble v0);
587 //extern void (GLAPIENTRY *qglVertexAttrib2fARB)(GLuint index, GLfloat v0, GLfloat v1);
588 //extern void (GLAPIENTRY *qglVertexAttrib2sARB)(GLuint index, GLshort v0, GLshort v1);
589 //extern void (GLAPIENTRY *qglVertexAttrib2dARB)(GLuint index, GLdouble v0, GLdouble v1);
590 //extern void (GLAPIENTRY *qglVertexAttrib3fARB)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2);
591 //extern void (GLAPIENTRY *qglVertexAttrib3sARB)(GLuint index, GLshort v0, GLshort v1, GLshort v2);
592 //extern void (GLAPIENTRY *qglVertexAttrib3dARB)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2);
593 //extern void (GLAPIENTRY *qglVertexAttrib4fARB)(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
594 //extern void (GLAPIENTRY *qglVertexAttrib4sARB)(GLuint index, GLshort v0, GLshort v1, GLshort v2, GLshort v3);
595 //extern void (GLAPIENTRY *qglVertexAttrib4dARB)(GLuint index, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
596 //extern void (GLAPIENTRY *qglVertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
597 //extern void (GLAPIENTRY *qglVertexAttrib1fvARB)(GLuint index, const GLfloat *v);
598 //extern void (GLAPIENTRY *qglVertexAttrib1svARB)(GLuint index, const GLshort *v);
599 //extern void (GLAPIENTRY *qglVertexAttrib1dvARB)(GLuint index, const GLdouble *v);
600 //extern void (GLAPIENTRY *qglVertexAttrib2fvARB)(GLuint index, const GLfloat *v);
601 //extern void (GLAPIENTRY *qglVertexAttrib2svARB)(GLuint index, const GLshort *v);
602 //extern void (GLAPIENTRY *qglVertexAttrib2dvARB)(GLuint index, const GLdouble *v);
603 //extern void (GLAPIENTRY *qglVertexAttrib3fvARB)(GLuint index, const GLfloat *v);
604 //extern void (GLAPIENTRY *qglVertexAttrib3svARB)(GLuint index, const GLshort *v);
605 //extern void (GLAPIENTRY *qglVertexAttrib3dvARB)(GLuint index, const GLdouble *v);
606 //extern void (GLAPIENTRY *qglVertexAttrib4fvARB)(GLuint index, const GLfloat *v);
607 //extern void (GLAPIENTRY *qglVertexAttrib4svARB)(GLuint index, const GLshort *v);
608 //extern void (GLAPIENTRY *qglVertexAttrib4dvARB)(GLuint index, const GLdouble *v);
609 //extern void (GLAPIENTRY *qglVertexAttrib4ivARB)(GLuint index, const GLint *v);
610 //extern void (GLAPIENTRY *qglVertexAttrib4bvARB)(GLuint index, const GLbyte *v);
611 //extern void (GLAPIENTRY *qglVertexAttrib4ubvARB)(GLuint index, const GLubyte *v);
612 //extern void (GLAPIENTRY *qglVertexAttrib4usvARB)(GLuint index, const GLushort *v);
613 //extern void (GLAPIENTRY *qglVertexAttrib4uivARB)(GLuint index, const GLuint *v);
614 //extern void (GLAPIENTRY *qglVertexAttrib4NbvARB)(GLuint index, const GLbyte *v);
615 //extern void (GLAPIENTRY *qglVertexAttrib4NsvARB)(GLuint index, const GLshort *v);
616 //extern void (GLAPIENTRY *qglVertexAttrib4NivARB)(GLuint index, const GLint *v);
617 //extern void (GLAPIENTRY *qglVertexAttrib4NubvARB)(GLuint index, const GLubyte *v);
618 //extern void (GLAPIENTRY *qglVertexAttrib4NusvARB)(GLuint index, const GLushort *v);
619 //extern void (GLAPIENTRY *qglVertexAttrib4NuivARB)(GLuint index, const GLuint *v);
620 extern void (GLAPIENTRY *qglVertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
621 extern void (GLAPIENTRY *qglEnableVertexAttribArrayARB)(GLuint index);
622 extern void (GLAPIENTRY *qglDisableVertexAttribArrayARB)(GLuint index);
623 extern void (GLAPIENTRY *qglBindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB *name);
624 extern void (GLAPIENTRY *qglGetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
625 extern GLint (GLAPIENTRY *qglGetAttribLocationARB)(GLhandleARB programObj, const GLcharARB *name);
626 //extern void (GLAPIENTRY *qglGetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble *params);
627 //extern void (GLAPIENTRY *qglGetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat *params);
628 //extern void (GLAPIENTRY *qglGetVertexAttribivARB)(GLuint index, GLenum pname, GLint *params);
629 //extern void (GLAPIENTRY *qglGetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer);
630 #ifndef GL_VERTEX_SHADER_ARB
631 #define GL_VERTEX_SHADER_ARB                                            0x8B31
632 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB            0x8B4A
633 #define GL_MAX_VARYING_FLOATS_ARB                                       0x8B4B
634 #define GL_MAX_VERTEX_ATTRIBS_ARB                                       0x8869
635 #define GL_MAX_TEXTURE_IMAGE_UNITS_ARB                          0x8872
636 #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB           0x8B4C
637 #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB         0x8B4D
638 #define GL_MAX_TEXTURE_COORDS_ARB                                       0x8871
639 #define GL_VERTEX_PROGRAM_POINT_SIZE_ARB                        0x8642
640 #define GL_VERTEX_PROGRAM_TWO_SIDE_ARB                          0x8643
641 #define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB                         0x8B89
642 #define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB       0x8B8A
643 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB                      0x8622
644 #define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB                         0x8623
645 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB                       0x8624
646 #define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB                         0x8625
647 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB           0x886A
648 #define GL_CURRENT_VERTEX_ATTRIB_ARB                            0x8626
649 #define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB                      0x8645
650 #define GL_FLOAT                                                                        0x1406
651 #define GL_FLOAT_VEC2_ARB                                                       0x8B50
652 #define GL_FLOAT_VEC3_ARB                                                       0x8B51
653 #define GL_FLOAT_VEC4_ARB                                                       0x8B52
654 #define GL_FLOAT_MAT2_ARB                                                       0x8B5A
655 #define GL_FLOAT_MAT3_ARB                                                       0x8B5B
656 #define GL_FLOAT_MAT4_ARB                                                       0x8B5C
657 #endif
658
659 // GL_ARB_fragment_shader
660 extern int gl_support_fragment_shader;
661 #ifndef GL_FRAGMENT_SHADER_ARB
662 #define GL_FRAGMENT_SHADER_ARB                                          0x8B30
663 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB          0x8B49
664 #define GL_MAX_TEXTURE_COORDS_ARB                                       0x8871
665 #define GL_MAX_TEXTURE_IMAGE_UNITS_ARB                          0x8872
666 #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB          0x8B8B
667 #endif
668
669 // GL_ARB_shading_language_100
670 extern int gl_support_shading_language_100;
671 #ifndef GL_SHADING_LANGUAGE_VERSION_ARB
672 #define GL_SHADING_LANGUAGE_VERSION_ARB                         0x8B8C
673 #endif
674
675 // GL_EXT_bgr
676 #define GL_BGR                                  0x80E0
677
678 // GL_EXT_bgra
679 #define GL_BGRA                                 0x80E1
680
681 #define DEBUGGL
682
683 #ifdef DEBUGGL
684 #define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = qglGetError();if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}}
685 extern int errornumber;
686 void GL_PrintError(int errornumber, char *filename, int linenumber);
687 #else
688 #define CHECKGLERROR
689 #endif
690
691 #endif
692