Home | History | Annotate | Download | only in WinQuake
      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 // disable data conversion warnings
     21 
     22 #ifdef _WIN32
     23 #pragma warning(disable : 4244)     // MIPS
     24 #pragma warning(disable : 4136)     // X86
     25 #pragma warning(disable : 4051)     // ALPHA
     26 #endif
     27 
     28 #ifdef _WIN32
     29 #include <windows.h>
     30 #endif
     31 
     32 #ifdef USE_OPENGLES
     33 
     34 #include <GLES/gl.h>
     35 
     36 #else
     37 
     38 #include <GL/gl.h>
     39 #include <GL/glu.h>
     40 
     41 #endif
     42 
     43 void GL_BeginRendering (int *x, int *y, int *width, int *height);
     44 void GL_EndRendering (void);
     45 
     46 #ifdef USE_OPENGLES
     47 
     48 #else // full OpenGL
     49 
     50 // Function prototypes for the Texture Object Extension routines
     51 typedef GLboolean (APIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
     52                     const GLboolean *);
     53 typedef void (APIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
     54 typedef void (APIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
     55 typedef void (APIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
     56 typedef GLboolean (APIENTRY *ISTEXFUNCPTR)(GLuint);
     57 typedef void (APIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
     58                     const GLclampf *);
     59 typedef void (APIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
     60 
     61 extern	BINDTEXFUNCPTR bindTexFunc;
     62 extern	DELTEXFUNCPTR delTexFunc;
     63 extern	TEXSUBIMAGEPTR TexSubImage2DFunc;
     64 
     65 #endif // USE_OPENGLES
     66 
     67 extern	int texture_extension_number;
     68 extern	int		texture_mode;
     69 
     70 extern	float	gldepthmin, gldepthmax;
     71 
     72 void GL_Upload32 (unsigned *data, int width, int height,  qboolean mipmap, qboolean alpha);
     73 void GL_Upload8 (byte *data, int width, int height,  qboolean mipmap, qboolean alpha);
     74 int GL_LoadTexture (const char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha);
     75 int GL_FindTexture (const char *identifier);
     76 
     77 typedef struct
     78 {
     79 	float	x, y, z;
     80 	float	s, t;
     81 	float	r, g, b;
     82 } glvert_t;
     83 
     84 extern glvert_t glv;
     85 
     86 extern	int glx, gly, glwidth, glheight;
     87 
     88 #ifdef _WIN32
     89 extern	PROC glArrayElementEXT;
     90 extern	PROC glColorPointerEXT;
     91 extern	PROC glTexturePointerEXT;
     92 extern	PROC glVertexPointerEXT;
     93 #endif
     94 
     95 // r_local.h -- private refresh defs
     96 
     97 #define ALIAS_BASE_SIZE_RATIO		(1.0 / 11.0)
     98 					// normalizing factor so player model works out to about
     99 					//  1 pixel per triangle
    100 #define	MAX_LBM_HEIGHT		480
    101 
    102 #define TILE_SIZE		128		// size of textures generated by R_GenTiledSurf
    103 
    104 #define SKYSHIFT		7
    105 #define	SKYSIZE			(1 << SKYSHIFT)
    106 #define SKYMASK			(SKYSIZE - 1)
    107 
    108 #define BACKFACE_EPSILON	0.01
    109 
    110 
    111 void R_TimeRefresh_f (void);
    112 void R_ReadPointFile_f (void);
    113 texture_t *R_TextureAnimation (texture_t *base);
    114 
    115 typedef struct surfcache_s
    116 {
    117 	struct surfcache_s	*next;
    118 	struct surfcache_s 	**owner;		// NULL is an empty chunk of memory
    119 	int					lightadj[MAXLIGHTMAPS]; // checked for strobe flush
    120 	int					dlight;
    121 	int					size;		// including header
    122 	unsigned			width;
    123 	unsigned			height;		// DEBUG only needed for debug
    124 	float				mipscale;
    125 	struct texture_s	*texture;	// checked for animating textures
    126 	byte				data[4];	// width*height elements
    127 } surfcache_t;
    128 
    129 
    130 typedef struct
    131 {
    132 	pixel_t		*surfdat;	// destination for generated surface
    133 	int			rowbytes;	// destination logical width in bytes
    134 	msurface_t	*surf;		// description for surface to generate
    135 	fixed8_t	lightadj[MAXLIGHTMAPS];
    136 							// adjust for lightmap levels for dynamic lighting
    137 	texture_t	*texture;	// corrected for animating textures
    138 	int			surfmip;	// mipmapped ratio of surface texels / world pixels
    139 	int			surfwidth;	// in mipmapped texels
    140 	int			surfheight;	// in mipmapped texels
    141 } drawsurf_t;
    142 
    143 
    144 typedef enum {
    145 	pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2,
    146 	ptype_t_max = 1 << 30
    147 } ptype_t;
    148 
    149 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
    150 typedef struct particle_s
    151 {
    152 // driver-usable fields
    153 	vec3_t		org;
    154 	float		color;
    155 // drivers never touch the following fields
    156 	struct particle_s	*next;
    157 	vec3_t		vel;
    158 	float		ramp;
    159 	float		die;
    160 	ptype_t		type;
    161 } particle_t;
    162 
    163 
    164 //====================================================
    165 
    166 
    167 extern	entity_t	r_worldentity;
    168 extern	qboolean	r_cache_thrash;		// compatability
    169 extern	vec3_t		modelorg, r_entorigin;
    170 extern	entity_t	*currententity;
    171 extern	int			r_visframecount;	// ??? what difs?
    172 extern	int			r_framecount;
    173 extern	mplane_t	frustum[4];
    174 extern	int		c_brush_polys, c_alias_polys;
    175 
    176 
    177 //
    178 // view origin
    179 //
    180 extern	vec3_t	vup;
    181 extern	vec3_t	vpn;
    182 extern	vec3_t	vright;
    183 extern	vec3_t	r_origin;
    184 
    185 //
    186 // screen size info
    187 //
    188 extern	refdef_t	r_refdef;
    189 extern	mleaf_t		*r_viewleaf, *r_oldviewleaf;
    190 extern	texture_t	*r_notexture_mip;
    191 extern	int		d_lightstylevalue[256];	// 8.8 fraction of base light value
    192 
    193 extern	qboolean	envmap;
    194 extern	int	currenttexture;
    195 extern	int	cnttextures[2];
    196 extern	int	particletexture;
    197 extern	int	playertextures;
    198 
    199 extern	int	skytexturenum;		// index in cl.loadmodel, not gl texture object
    200 
    201 extern	cvar_t	r_norefresh;
    202 extern	cvar_t	r_drawentities;
    203 extern	cvar_t	r_drawworld;
    204 extern	cvar_t	r_drawviewmodel;
    205 extern	cvar_t	r_speeds;
    206 extern	cvar_t	r_waterwarp;
    207 extern	cvar_t	r_fullbright;
    208 extern	cvar_t	r_lightmap;
    209 extern	cvar_t	r_shadows;
    210 extern	cvar_t	r_mirroralpha;
    211 extern	cvar_t	r_wateralpha;
    212 extern	cvar_t	r_dynamic;
    213 extern	cvar_t	r_novis;
    214 
    215 extern	cvar_t	gl_clear;
    216 extern	cvar_t	gl_cull;
    217 extern	cvar_t	gl_poly;
    218 extern	cvar_t	gl_texsort;
    219 extern	cvar_t	gl_smoothmodels;
    220 extern	cvar_t	gl_affinemodels;
    221 extern	cvar_t	gl_polyblend;
    222 extern	cvar_t	gl_keeptjunctions;
    223 extern	cvar_t	gl_reporttjunctions;
    224 extern	cvar_t	gl_flashblend;
    225 extern	cvar_t	gl_nocolors;
    226 extern	cvar_t	gl_doubleeyes;
    227 
    228 extern	int		gl_lightmap_format;
    229 extern	int		gl_solid_format;
    230 extern	int		gl_alpha_format;
    231 
    232 extern	cvar_t	gl_max_size;
    233 extern	cvar_t	gl_playermip;
    234 
    235 extern	int			mirrortexturenum;	// quake texturenum, not gltexturenum
    236 extern	qboolean	mirror;
    237 extern	mplane_t	*mirror_plane;
    238 
    239 extern	float	r_world_matrix[16];
    240 
    241 extern	const char *gl_vendor;
    242 extern	const char *gl_renderer;
    243 extern	const char *gl_version;
    244 extern	const char *gl_extensions;
    245 
    246 void R_TranslatePlayerSkin (int playernum);
    247 void GL_Bind (int texnum);
    248 
    249 // Multitexture
    250 #ifdef USE_OPENGLES
    251 
    252 #define    TEXTURE0_SGIS				GL_TEXTURE0
    253 #define    TEXTURE1_SGIS				GL_TEXTURE1
    254 
    255 #else
    256 #define    TEXTURE0_SGIS				0x835E
    257 #define    TEXTURE1_SGIS				0x835F
    258 #endif
    259 
    260 #ifndef _WIN32
    261 #define APIENTRY /* */
    262 
    263 typedef void (APIENTRY *lpMTexFUNC) (GLenum, GLfloat, GLfloat);
    264 typedef void (APIENTRY *lpSelTexFUNC) (GLenum);
    265 extern lpMTexFUNC qglMTexCoord2fSGIS;
    266 extern lpSelTexFUNC qglSelectTextureSGIS;
    267 
    268 #endif
    269 
    270 extern qboolean gl_mtexable;
    271 
    272 void GL_DisableMultitexture(void);
    273 void GL_EnableMultitexture(void);
    274 
    275 // Debugging
    276 
    277 #define DEBUG_OPENGL_CALLS
    278 #ifdef DEBUG_OPENGL_CALLS
    279 void checkGLImp(const char* state, const char* file, int line);
    280 
    281 #define GLCHECK(PROMPT)  checkGLImp(PROMPT, __FILE__, __LINE__)
    282 
    283 
    284 #define glAlphaFunc(...) do { glAlphaFunc(__VA_ARGS__); GLCHECK("glAlphaFunc");} while(0)
    285 #define glClearColor(...) do { glClearColor(__VA_ARGS__); GLCHECK("glClearColor");} while(0)
    286 #define glClearDepthf(...) do { glClearDepthf(__VA_ARGS__); GLCHECK("glClearDepthf");} while(0)
    287 #define glClipPlanef(...) do { glClipPlanef(__VA_ARGS__); GLCHECK("glClipPlanef");} while(0)
    288 #define glColor4f(...) do { glColor4f(__VA_ARGS__); GLCHECK("glColor4f");} while(0)
    289 #define glDepthRangef(...) do { glDepthRangef(__VA_ARGS__); GLCHECK("glDepthRangef");} while(0)
    290 #define glFogf(...) do { glFogf(__VA_ARGS__); GLCHECK("glFogf");} while(0)
    291 #define glFogfv(...) do { glFogfv(__VA_ARGS__); GLCHECK("glFogfv");} while(0)
    292 #define glFrustumf(...) do { glFrustumf(__VA_ARGS__); GLCHECK("glFrustumf");} while(0)
    293 #define glGetClipPlanef(...) do { glGetClipPlanef(__VA_ARGS__); GLCHECK("glGetClipPlanef");} while(0)
    294 #define glGetFloatv(...) do { glGetFloatv(__VA_ARGS__); GLCHECK("glGetFloatv");} while(0)
    295 #define glGetLightfv(...) do { glGetLightfv(__VA_ARGS__); GLCHECK("glGetLightfv");} while(0)
    296 #define glGetMaterialfv(...) do { glGetMaterialfv(__VA_ARGS__); GLCHECK("glGetMaterialfv");} while(0)
    297 #define glGetTexEnvfv(...) do { glGetTexEnvfv(__VA_ARGS__); GLCHECK("glGetTexEnvfv");} while(0)
    298 #define glGetTexParameterfv(...) do { glGetTexParameterfv(__VA_ARGS__); GLCHECK("glGetTexParameterfv");} while(0)
    299 #define glLightModelf(...) do { glLightModelf(__VA_ARGS__); GLCHECK("glLightModelf");} while(0)
    300 #define glLightModelfv(...) do { glLightModelfv(__VA_ARGS__); GLCHECK("glLightModelfv");} while(0)
    301 #define glLightf(...) do { glLightf(__VA_ARGS__); GLCHECK("glLightf");} while(0)
    302 #define glLightfv(...) do { glLightfv(__VA_ARGS__); GLCHECK("glLightfv");} while(0)
    303 #define glLineWidth(...) do { glLineWidth(__VA_ARGS__); GLCHECK("glLineWidth");} while(0)
    304 #define glLoadMatrixf(...) do { glLoadMatrixf(__VA_ARGS__); GLCHECK("glLoadMatrixf");} while(0)
    305 #define glMaterialf(...) do { glMaterialf(__VA_ARGS__); GLCHECK("glMaterialf");} while(0)
    306 #define glMaterialfv(...) do { glMaterialfv(__VA_ARGS__); GLCHECK("glMaterialfv");} while(0)
    307 #define glMultMatrixf(...) do { glMultMatrixf(__VA_ARGS__); GLCHECK("glMultMatrixf");} while(0)
    308 #define glMultiTexCoord4f(...) do { glMultiTexCoord4f(__VA_ARGS__); GLCHECK("glMultiTexCoord4f");} while(0)
    309 #define glNormal3f(...) do { glNormal3f(__VA_ARGS__); GLCHECK("glNormal3f");} while(0)
    310 #define glOrthof(...) do { glOrthof(__VA_ARGS__); GLCHECK("glOrthof");} while(0)
    311 #define glPointParameterf(...) do { glPointParameterf(__VA_ARGS__); GLCHECK("glPointParameterf");} while(0)
    312 #define glPointParameterfv(...) do { glPointParameterfv(__VA_ARGS__); GLCHECK("glPointParameterfv");} while(0)
    313 #define glPointSize(...) do { glPointSize(__VA_ARGS__); GLCHECK("glPointSize");} while(0)
    314 #define glPolygonOffset(...) do { glPolygonOffset(__VA_ARGS__); GLCHECK("glPolygonOffset");} while(0)
    315 #define glRotatef(...) do { glRotatef(__VA_ARGS__); GLCHECK("glRotatef");} while(0)
    316 #define glScalef(...) do { glScalef(__VA_ARGS__); GLCHECK("glScalef");} while(0)
    317 #define glTexEnvf(...) do { glTexEnvf(__VA_ARGS__); GLCHECK("glTexEnvf");} while(0)
    318 #define glTexEnvfv(...) do { glTexEnvfv(__VA_ARGS__); GLCHECK("glTexEnvfv");} while(0)
    319 #define glTexParameterf(...) do { glTexParameterf(__VA_ARGS__); GLCHECK("glTexParameterf");} while(0)
    320 #define glTexParameterfv(...) do { glTexParameterfv(__VA_ARGS__); GLCHECK("glTexParameterfv");} while(0)
    321 #define glTranslatef(...) do { glTranslatef(__VA_ARGS__); GLCHECK("glTranslatef");} while(0)
    322 #define glActiveTexture(...) do { glActiveTexture(__VA_ARGS__); GLCHECK("glActiveTexture");} while(0)
    323 #define glAlphaFuncx(...) do { glAlphaFuncx(__VA_ARGS__); GLCHECK("glAlphaFuncx");} while(0)
    324 #define glBindBuffer(...) do { glBindBuffer(__VA_ARGS__); GLCHECK("glBindBuffer");} while(0)
    325 #define glBindTexture(...) do { glBindTexture(__VA_ARGS__); GLCHECK("glBindTexture");} while(0)
    326 #define glBlendFunc(...) do { glBlendFunc(__VA_ARGS__); GLCHECK("glBlendFunc");} while(0)
    327 #define glBufferData(...) do { glBufferData(__VA_ARGS__); GLCHECK("glBufferData");} while(0)
    328 #define glBufferSubData(...) do { glBufferSubData(__VA_ARGS__); GLCHECK("glBufferSubData");} while(0)
    329 #define glClear(...) do { glClear(__VA_ARGS__); GLCHECK("glClear");} while(0)
    330 #define glClearColorx(...) do { glClearColorx(__VA_ARGS__); GLCHECK("glClearColorx");} while(0)
    331 #define glClearDepthx(...) do { glClearDepthx(__VA_ARGS__); GLCHECK("glClearDepthx");} while(0)
    332 #define glClearStencil(...) do { glClearStencil(__VA_ARGS__); GLCHECK("glClearStencil");} while(0)
    333 #define glClientActiveTexture(...) do { glClientActiveTexture(__VA_ARGS__); GLCHECK("glClientActiveTexture");} while(0)
    334 #define glClipPlanex(...) do { glClipPlanex(__VA_ARGS__); GLCHECK("glClipPlanex");} while(0)
    335 #define glColor4ub(...) do { glColor4ub(__VA_ARGS__); GLCHECK("glColor4ub");} while(0)
    336 #define glColor4x(...) do { glColor4x(__VA_ARGS__); GLCHECK("glColor4x");} while(0)
    337 #define glColorMask(...) do { glColorMask(__VA_ARGS__); GLCHECK("glColorMask");} while(0)
    338 #define glColorPointer(...) do { glColorPointer(__VA_ARGS__); GLCHECK("glColorPointer");} while(0)
    339 #define glCompressedTexImage2D(...) do { glCompressedTexImage2D(__VA_ARGS__); GLCHECK("glCompressedTexImage2D");} while(0)
    340 #define glCompressedTexSubImage2D(...) do { glCompressedTexSubImage2D(__VA_ARGS__); GLCHECK("glCompressedTexSubImage2D");} while(0)
    341 #define glCopyTexImage2D(...) do { glCopyTexImage2D(__VA_ARGS__); GLCHECK("glCopyTexImage2D");} while(0)
    342 #define glCopyTexSubImage2D(...) do { glCopyTexSubImage2D(__VA_ARGS__); GLCHECK("glCopyTexSubImage2D");} while(0)
    343 #define glCullFace(...) do { glCullFace(__VA_ARGS__); GLCHECK("glCullFace");} while(0)
    344 #define glDeleteBuffers(...) do { glDeleteBuffers(__VA_ARGS__); GLCHECK("glDeleteBuffers");} while(0)
    345 #define glDeleteTextures(...) do { glDeleteTextures(__VA_ARGS__); GLCHECK("glDeleteTextures");} while(0)
    346 #define glDepthFunc(...) do { glDepthFunc(__VA_ARGS__); GLCHECK("glDepthFunc");} while(0)
    347 #define glDepthMask(...) do { glDepthMask(__VA_ARGS__); GLCHECK("glDepthMask");} while(0)
    348 #define glDepthRangex(...) do { glDepthRangex(__VA_ARGS__); GLCHECK("glDepthRangex");} while(0)
    349 #define glDisable(...) do { glDisable(__VA_ARGS__); GLCHECK("glDisable");} while(0)
    350 #define glDisableClientState(...) do { glDisableClientState(__VA_ARGS__); GLCHECK("glDisableClientState");} while(0)
    351 #define glDrawArrays(...) do { glDrawArrays(__VA_ARGS__); GLCHECK("glDrawArrays");} while(0)
    352 #define glDrawElements(...) do { glDrawElements(__VA_ARGS__); GLCHECK("glDrawElements");} while(0)
    353 #define glEnable(...) do { glEnable(__VA_ARGS__); GLCHECK("glEnable");} while(0)
    354 #define glEnableClientState(...) do { glEnableClientState(__VA_ARGS__); GLCHECK("glEnableClientState");} while(0)
    355 #define glFinish(...) do { glFinish(__VA_ARGS__); GLCHECK("glFinish");} while(0)
    356 #define glFlush(...) do { glFlush(__VA_ARGS__); GLCHECK("glFlush");} while(0)
    357 #define glFogx(...) do { glFogx(__VA_ARGS__); GLCHECK("glFogx");} while(0)
    358 #define glFogxv(...) do { glFogxv(__VA_ARGS__); GLCHECK("glFogxv");} while(0)
    359 #define glFrontFace(...) do { glFrontFace(__VA_ARGS__); GLCHECK("glFrontFace");} while(0)
    360 #define glFrustumx(...) do { glFrustumx(__VA_ARGS__); GLCHECK("glFrustumx");} while(0)
    361 #define glGetBooleanv(...) do { glGetBooleanv(__VA_ARGS__); GLCHECK("glGetBooleanv");} while(0)
    362 #define glGetBufferParameteriv(...) do { glGetBufferParameteriv(__VA_ARGS__); GLCHECK("glGetBufferParameteriv");} while(0)
    363 #define glGetClipPlanex(...) do { glGetClipPlanex(__VA_ARGS__); GLCHECK("glGetClipPlanex");} while(0)
    364 #define glGenBuffers(...) do { glGenBuffers(__VA_ARGS__); GLCHECK("glGenBuffers");} while(0)
    365 #define glGenTextures(...) do { glGenTextures(__VA_ARGS__); GLCHECK("glGenTextures");} while(0)
    366 // #define glGetError(...) do { glGetError(__VA_ARGS__); GLCHECK("glGetError");} while(0)
    367 // #define glGetFixedv(...) do { glGetFixedv(__VA_ARGS__); GLCHECK("glGetFixedv");} while(0)
    368 // #define glGetIntegerv(...) do { glGetIntegerv(__VA_ARGS__); GLCHECK("glGetIntegerv");} while(0)
    369 // #define glGetLightxv(...) do { glGetLightxv(__VA_ARGS__); GLCHECK("glGetLightxv");} while(0)
    370 // #define glGetMaterialxv(...) do { glGetMaterialxv(__VA_ARGS__); GLCHECK("glGetMaterialxv");} while(0)
    371 // #define glGetPointerv(...) do { glGetPointerv(__VA_ARGS__); GLCHECK("glGetPointerv");} while(0)
    372 // #define glGetString(...) do { glGetString(__VA_ARGS__); GLCHECK("glGetString");} while(0)
    373 // #define glGetTexEnviv(...) do { glGetTexEnviv(__VA_ARGS__); GLCHECK("glGetTexEnviv");} while(0)
    374 // #define glGetTexEnvxv(...) do { glGetTexEnvxv(__VA_ARGS__); GLCHECK("glGetTexEnvxv");} while(0)
    375 // #define glGetTexParameteriv(...) do { glGetTexParameteriv(__VA_ARGS__); GLCHECK("glGetTexParameteriv");} while(0)
    376 // #define glGetTexParameterxv(...) do { glGetTexParameterxv(__VA_ARGS__); GLCHECK("glGetTexParameterxv");} while(0)
    377 #define glHint(...) do { glHint(__VA_ARGS__); GLCHECK("glHint");} while(0)
    378 #define glIsBuffer(...) do { glIsBuffer(__VA_ARGS__); GLCHECK("glIsBuffer");} while(0)
    379 #define glIsEnabled(...) do { glIsEnabled(__VA_ARGS__); GLCHECK("glIsEnabled");} while(0)
    380 #define glIsTexture(...) do { glIsTexture(__VA_ARGS__); GLCHECK("glIsTexture");} while(0)
    381 #define glLightModelx(...) do { glLightModelx(__VA_ARGS__); GLCHECK("glLightModelx");} while(0)
    382 #define glLightModelxv(...) do { glLightModelxv(__VA_ARGS__); GLCHECK("glLightModelxv");} while(0)
    383 #define glLightx(...) do { glLightx(__VA_ARGS__); GLCHECK("glLightx");} while(0)
    384 #define glLightxv(...) do { glLightxv(__VA_ARGS__); GLCHECK("glLightxv");} while(0)
    385 #define glLineWidthx(...) do { glLineWidthx(__VA_ARGS__); GLCHECK("glLineWidthx");} while(0)
    386 #define glLoadIdentity(...) do { glLoadIdentity(__VA_ARGS__); GLCHECK("glLoadIdentity");} while(0)
    387 #define glLoadMatrixx(...) do { glLoadMatrixx(__VA_ARGS__); GLCHECK("glLoadMatrixx");} while(0)
    388 #define glLogicOp(...) do { glLogicOp(__VA_ARGS__); GLCHECK("glLogicOp");} while(0)
    389 #define glMaterialx(...) do { glMaterialx(__VA_ARGS__); GLCHECK("glMaterialx");} while(0)
    390 #define glMaterialxv(...) do { glMaterialxv(__VA_ARGS__); GLCHECK("glMaterialxv");} while(0)
    391 #define glMatrixMode(...) do { glMatrixMode(__VA_ARGS__); GLCHECK("glMatrixMode");} while(0)
    392 #define glMultMatrixx(...) do { glMultMatrixx(__VA_ARGS__); GLCHECK("glMultMatrixx");} while(0)
    393 #define glMultiTexCoord4x(...) do { glMultiTexCoord4x(__VA_ARGS__); GLCHECK("glMultiTexCoord4x");} while(0)
    394 #define glNormal3x(...) do { glNormal3x(__VA_ARGS__); GLCHECK("glNormal3x");} while(0)
    395 #define glNormalPointer(...) do { glNormalPointer(__VA_ARGS__); GLCHECK("glNormalPointer");} while(0)
    396 #define glOrthox(...) do { glOrthox(__VA_ARGS__); GLCHECK("glOrthox");} while(0)
    397 #define glPixelStorei(...) do { glPixelStorei(__VA_ARGS__); GLCHECK("glPixelStorei");} while(0)
    398 #define glPointParameterx(...) do { glPointParameterx(__VA_ARGS__); GLCHECK("glPointParameterx");} while(0)
    399 #define glPointParameterxv(...) do { glPointParameterxv(__VA_ARGS__); GLCHECK("glPointParameterxv");} while(0)
    400 #define glPointSizex(...) do { glPointSizex(__VA_ARGS__); GLCHECK("glPointSizex");} while(0)
    401 #define glPolygonOffsetx(...) do { glPolygonOffsetx(__VA_ARGS__); GLCHECK("glPolygonOffsetx");} while(0)
    402 #define glPopMatrix(...) do { glPopMatrix(__VA_ARGS__); GLCHECK("glPopMatrix");} while(0)
    403 #define glPushMatrix(...) do { glPushMatrix(__VA_ARGS__); GLCHECK("glPushMatrix");} while(0)
    404 #define glReadPixels(...) do { glReadPixels(__VA_ARGS__); GLCHECK("glReadPixels");} while(0)
    405 #define glRotatex(...) do { glRotatex(__VA_ARGS__); GLCHECK("glRotatex");} while(0)
    406 #define glSampleCoverage(...) do { glSampleCoverage(__VA_ARGS__); GLCHECK("glSampleCoverage");} while(0)
    407 #define glSampleCoveragex(...) do { glSampleCoveragex(__VA_ARGS__); GLCHECK("glSampleCoveragex");} while(0)
    408 #define glScalex(...) do { glScalex(__VA_ARGS__); GLCHECK("glScalex");} while(0)
    409 #define glScissor(...) do { glScissor(__VA_ARGS__); GLCHECK("glScissor");} while(0)
    410 #define glShadeModel(...) do { glShadeModel(__VA_ARGS__); GLCHECK("glShadeModel");} while(0)
    411 #define glStencilFunc(...) do { glStencilFunc(__VA_ARGS__); GLCHECK("glStencilFunc");} while(0)
    412 #define glStencilMask(...) do { glStencilMask(__VA_ARGS__); GLCHECK("glStencilMask");} while(0)
    413 #define glStencilOp(...) do { glStencilOp(__VA_ARGS__); GLCHECK("glStencilOp");} while(0)
    414 #define glTexCoordPointer(...) do { glTexCoordPointer(__VA_ARGS__); GLCHECK("glTexCoordPointer");} while(0)
    415 #define glTexEnvi(...) do { glTexEnvi(__VA_ARGS__); GLCHECK("glTexEnvi");} while(0)
    416 #define glTexEnvx(...) do { glTexEnvx(__VA_ARGS__); GLCHECK("glTexEnvx");} while(0)
    417 #define glTexEnviv(...) do { glTexEnviv(__VA_ARGS__); GLCHECK("glTexEnviv");} while(0)
    418 #define glTexEnvxv(...) do { glTexEnvxv(__VA_ARGS__); GLCHECK("glTexEnvxv");} while(0)
    419 #define glTexImage2D(...) do { glTexImage2D(__VA_ARGS__); GLCHECK("glTexImage2D");} while(0)
    420 #define glTexParameteri(...) do { glTexParameteri(__VA_ARGS__); GLCHECK("glTexParameteri");} while(0)
    421 #define glTexParameterx(...) do { glTexParameterx(__VA_ARGS__); GLCHECK("glTexParameterx");} while(0)
    422 #define glTexParameteriv(...) do { glTexParameteriv(__VA_ARGS__); GLCHECK("glTexParameteriv");} while(0)
    423 #define glTexParameterxv(...) do { glTexParameterxv(__VA_ARGS__); GLCHECK("glTexParameterxv");} while(0)
    424 #define glTexSubImage2D(...) do { glTexSubImage2D(__VA_ARGS__); GLCHECK("glTexSubImage2D");} while(0)
    425 #define glTranslatex(...) do { glTranslatex(__VA_ARGS__); GLCHECK("glTranslatex");} while(0)
    426 #define glVertexPointer(...) do { glVertexPointer(__VA_ARGS__); GLCHECK("glVertexPointer");} while(0)
    427 #define glViewport(...) do { glViewport(__VA_ARGS__); GLCHECK("glViewport");} while(0)
    428 
    429 
    430 
    431 #else
    432 #define GLCHECK(PROMPT) do {} while(0)
    433 #endif
    434