1 
2 /*
3  * Copyright (C) 1997-2001 Id Software, Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free
7  * Software Foundation; either version 2 of the License, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, write to the Free Software Foundation, Inc., 59
18  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #ifndef _GL_LOCAL_H_
23 #define _GL_LOCAL_H_
24 
25 #include <stdio.h>
26 #include <math.h>
27 
28 #include <GL/glx.h>
29 #include <GL/glu.h>
30 #include <GL/glext.h>
31 
32 #include <png.h>
33 #include <zlib.h>
34 #include <jpeglib.h>
35 
36 #include "../client/ref.h"
37 
38 #include "qgl.h"
39 
40 #define	REF_VERSION	"GL 0.01"
41 
42 /* up / down */
43 #define	PITCH	0
44 
45 /* left / right */
46 #define	YAW		1
47 
48 /* fall over */
49 #define	ROLL	2
50 
51 #define MAX_MODEL_DLIGHTS 8
52 
53 #define DIV254BY255 (0.9960784313725490196078431372549f)
54 #define DIV255 (0.003921568627450980392156862745098f)
55 #define DIV256 (0.00390625f)
56 #define DIV512 (0.001953125f)
57 
58 #ifndef __VIDDEF_T
59 #define __VIDDEF_T
60 typedef struct {
61 	int	width , height;	/* coordinates from main game */
62 } viddef_t;
63 
64 #endif
65 
66 extern viddef_t	vid;
67 
68 
69 /*
70  * skins will be outline flood filled and mip mapped pics and sprites with alpha
71  * will be outline flood filled pic won't be mip mapped
72  *
73  * model skin sprite frame wall texture pic
74  *
75  */
76 
77 typedef enum {
78 	it_skin,
79 	it_sprite,
80 	it_wall,
81 	it_pic,
82 	it_sky,
83 	it_part
84 } imagetype_t;
85 
86 typedef struct image_s {
87 
88 	char		name[MAX_QPATH];		/* game path, including extension */
89 	char		bare_name[MAX_QPATH];		/* filename only, as called when searching */
90 	imagetype_t	type;
91 	int		width, height;			/* source image */
92 	int		upload_width, upload_height;	/* after power of two and picmip */
93 	int		registration_sequence;		/* 0 = free */
94 	struct msurface_s *texturechain;		/* for sort-by-texture world drawing */
95 	int		texnum;				/* gl texture binding */
96 	float		sl, tl, sh, th;			/* 0,0 - 1,1 unless part of the scrap */
97 
98 	qboolean	scrap;
99 	qboolean	has_alpha;
100 	qboolean	paletted;
101 
102 	qboolean	is_cin;
103 	float		replace_scale;
104 
105 } image_t;
106 
107 #define	TEXNUM_LIGHTMAPS	1024
108 #define	TEXNUM_SCRAPS		1152
109 #define	TEXNUM_IMAGES		1153
110 
111 #define		MAX_GLTEXTURES	1024
112 
113 /* =================================================================== */
114 
115 typedef enum {
116 
117 	rserr_ok,
118 	rserr_invalid_fullscreen,
119 	rserr_invalid_mode,
120 	rserr_unknown
121 
122 } rserr_t;
123 
124 #include "gl_model.h"
125 
126 void		GL_BeginRendering(int *x, int *y, int *width, int *height);
127 void		GL_EndRendering(void);
128 
129 void		GL_SetDefaultState(void);
130 void		GL_UpdateSwapInterval(void);
131 
132 extern float	gldepthmin, gldepthmax;
133 
134 typedef struct {
135 	float		x, y, z;
136 	float		s, t;
137 	float		r, g, b;
138 } glvert_t;
139 
140 
141 #define	MAX_LBM_HEIGHT		480
142 
143 #define BACKFACE_EPSILON	0.01
144 
145 
146 /* ==================================================== */
147 
148 extern image_t	gltextures[MAX_GLTEXTURES];
149 extern int	numgltextures;
150 
151 #ifdef QMAX
152 #define PARTICLE_TYPES 1024
153 #endif
154 
155 #ifdef QMAX
156 extern image_t *r_particletextures[PARTICLE_TYPES];
157 extern image_t *r_particlebeam;
158 #else
159 extern image_t *r_particletexture;
160 #endif
161 
162 extern image_t *r_detailtexture;
163 extern image_t *r_shelltexture;
164 extern image_t *r_radarmap;
165 extern image_t *r_around;
166 extern image_t *r_caustictexture;
167 extern image_t *r_bholetexture;
168 extern image_t *r_lblendimage;
169 
170 extern image_t *r_celtexture;
171 extern image_t *r_notexture;
172 extern image_t *r_dynamicimage;
173 extern entity_t *currententity;
174 extern model_t *currentmodel;
175 extern int	r_visframecount;
176 extern int	r_framecount;
177 extern cplane_t	frustum[4];
178 extern int	c_brush_polys, c_alias_polys;
179 
180 
181 extern int	gl_filter_min, gl_filter_max;
182 
183 /* view origin */
184 extern vec3_t	vup;
185 extern vec3_t	vpn;
186 extern vec3_t	vright;
187 extern vec3_t	r_origin;
188 
189 /* screen size info */
190 extern refdef_t	r_refdef;
191 extern int	r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2;
192 
193 extern cvar_t  *skydistance;
194 
195 extern cvar_t  *r_norefresh;
196 extern cvar_t  *r_lefthand;
197 extern cvar_t  *r_drawentities;
198 extern cvar_t  *r_drawworld;
199 extern cvar_t  *r_speeds;
200 extern cvar_t  *r_fullbright;
201 extern cvar_t  *r_novis;
202 extern cvar_t  *r_nocull;
203 extern cvar_t  *r_lerpmodels;
204 
205 #ifdef QMAX
206 extern cvar_t  *gl_partscale;
207 extern cvar_t  *gl_transrendersort;
208 extern cvar_t  *gl_particlelighting;
209 extern cvar_t  *gl_particledistance;
210 #endif
211 
212 #ifndef QMAX
213 extern cvar_t  *gl_particle_min_size;
214 extern cvar_t  *gl_particle_max_size;
215 extern cvar_t  *gl_particle_size;
216 extern cvar_t  *gl_particle_att_a;
217 extern cvar_t  *gl_particle_att_b;
218 extern cvar_t  *gl_particle_att_c;
219 extern cvar_t  *gl_particles;
220 #endif
221 
222 extern cvar_t  *gl_dlight_cutoff;
223 extern cvar_t  *gl_stainmaps;
224 
225 extern cvar_t  *r_model_lightlerp;
226 extern cvar_t  *r_model_dlights;
227 extern cvar_t  *r_model_alpha;
228 
229 extern cvar_t  *r_lightlevel;	/* FIXME: This is a HACK to get the client's light level */
230 
231 extern cvar_t  *r_overbrightbits;
232 extern cvar_t  *r_cellshading;
233 extern cvar_t  *r_cellshading_width;
234 
235 extern cvar_t  *gl_ext_mtexcombine;
236 extern cvar_t  *gl_ext_texture_compression;	/* Heffo - ARB Texture Compression */
237 extern cvar_t  *gl_anisotropic;
238 extern cvar_t  *gl_anisotropic_avail;
239 extern cvar_t  *gl_ext_nv_multisample_filter_hint;
240 extern cvar_t  *gl_nv_fog;
241 
242 extern cvar_t  *font_color;
243 
244 extern cvar_t  *gl_vertex_arrays;
245 extern cvar_t  *gl_colordepth;
246 extern cvar_t  *gl_ext_palettedtexture;
247 extern cvar_t  *gl_ext_multitexture;
248 extern cvar_t  *gl_ext_pointparameters;
249 extern cvar_t  *gl_ext_compiled_vertex_array;
250 
251 extern cvar_t  *gl_screenshot_quality;
252 
253 extern cvar_t  *gl_surftrans_light;
254 extern cvar_t  *gl_nosubimage;
255 extern cvar_t  *gl_bitdepth;
256 extern cvar_t  *gl_mode;
257 extern cvar_t  *gl_log;
258 extern cvar_t  *gl_lightmap;
259 extern cvar_t  *gl_shadows;
260 extern cvar_t  *gl_shadows_alpha;
261 extern cvar_t  *gl_shellstencil;
262 extern cvar_t  *gl_dynamic;
263 extern cvar_t  *gl_monolightmap;
264 extern cvar_t  *gl_nobind;
265 extern cvar_t  *gl_round_down;
266 extern cvar_t  *gl_picmip;
267 extern cvar_t  *gl_skymip;
268 extern cvar_t  *gl_showtris;
269 extern cvar_t  *gl_finish;
270 extern cvar_t  *gl_clear;
271 extern cvar_t  *gl_cull;
272 extern cvar_t  *gl_poly;
273 extern cvar_t  *gl_texsort;
274 extern cvar_t  *gl_polyblend;
275 extern cvar_t  *gl_flashblend;
276 extern cvar_t  *gl_lightmaptype;
277 extern cvar_t  *gl_modulate;
278 extern cvar_t  *gl_playermip;
279 extern cvar_t  *gl_drawbuffer;
280 extern cvar_t  *gl_3dlabs_broken;
281 extern cvar_t  *gl_driver;
282 extern cvar_t  *gl_texturemode;
283 extern cvar_t  *gl_texturealphamode;
284 extern cvar_t  *gl_texturesolidmode;
285 extern cvar_t  *gl_saturatelighting;
286 extern cvar_t  *gl_lockpvs;
287 
288 extern cvar_t  *gl_screenshot_jpeg;	        /* Heffo - JPEG Screenshots */
289 extern cvar_t  *gl_screenshot_jpeg_quality;	/* Heffo - JPEG Screenshots */
290 
291 extern cvar_t  *gl_fogenable;	  /* Enable */
292 extern cvar_t  *gl_fogred;	  /* Red */
293 extern cvar_t  *gl_foggreen;	  /* Green */
294 extern cvar_t  *gl_fogblue;	  /* Blue */
295 extern cvar_t  *gl_fogstart;	  /* Start */
296 extern cvar_t  *gl_fogend;	  /* End */
297 extern cvar_t  *gl_fogdensity;	  /* Density */
298 extern cvar_t  *gl_fogunderwater; /* Under Water Fog */
299 
300 extern cvar_t  *gl_water_waves;   /* Water waves */
301 extern cvar_t  *gl_water_caustics;
302 
303 extern cvar_t  *gl_flares;
304 extern cvar_t  *gl_flare_force_size;
305 extern cvar_t  *gl_flare_force_style;
306 extern cvar_t  *gl_flare_intensity;
307 extern cvar_t  *gl_flare_maxdist;
308 extern cvar_t  *gl_flare_scale;
309 
310 /* Knightmare- allow disabling the nVidia water warp */
311 extern cvar_t  *gl_water_pixel_shader_warp;
312 extern cvar_t  *gl_blooms;
313 extern cvar_t  *gl_glares;
314 extern cvar_t  *gl_glares_size;
315 extern cvar_t  *gl_glares_intens;
316 
317 extern cvar_t  *gl_detailtextures;
318 
319 extern cvar_t  *gl_reflection_fragment_program;
320 extern cvar_t  *gl_reflection;			/* MPO */
321 extern cvar_t  *gl_reflection_debug;		/* MPO	for debugging the reflection */
322 extern cvar_t  *gl_reflection_max;		/* MPO  max number of water reflections */
323 extern cvar_t  *gl_reflection_shader;		/* MPO	use fragment shaders */
324 extern cvar_t  *gl_reflection_shader_image;
325 extern cvar_t  *gl_reflection_water_surface;
326 
327 extern cvar_t  *gl_minimap;
328 extern cvar_t  *gl_minimap_size;
329 extern cvar_t  *gl_minimap_zoom;
330 extern cvar_t  *gl_minimap_style;
331 extern cvar_t  *gl_minimap_x;
332 extern cvar_t  *gl_minimap_y;
333 
334 extern cvar_t  *gl_decals;
335 extern cvar_t  *gl_decals_time;
336 extern cvar_t  *gl_alpha_surfaces;
337 
338 extern cvar_t  *vid_fullscreen;
339 extern cvar_t  *vid_gamma;
340 extern cvar_t  *cl_hudscale;
341 extern cvar_t  *cl_big_maps;
342 extern cvar_t  *cl_3dcam;
343 extern cvar_t  *deathmatch;
344 
345 extern cvar_t  *intensity;
346 
347 extern int	gl_lightmap_format;
348 extern int	gl_solid_format;
349 extern int	gl_alpha_format;
350 extern int	gl_tex_solid_format;
351 extern int	gl_tex_alpha_format;
352 
353 extern int	c_visible_lightmaps;
354 extern int	c_visible_textures;
355 
356 extern float	r_world_matrix[16];
357 
358 #define	MAX_FLARES	1024
359 #define	FLARE_STYLES	6
360 
361 typedef struct {
362 	int		size;
363 	int		style;
364 	vec3_t		color;
365 	vec3_t		origin;
366 } flare_t;
367 
368 extern int	r_numflares;
369 extern flare_t	*r_flares[MAX_FLARES];
370 
371 
372 void		R_TranslatePlayerSkin(int playernum);
373 void		GL_Bind   (int texnum);
374 void		GL_MBind  (GLenum target, int texnum);
375 void		GL_TexEnv (GLenum value);
376 void		GL_EnableMultitexture(qboolean enable);
377 void		GL_Enable3dTextureUnit(qboolean enable);	/* Dukey */
378 void		GL_SelectTexture(GLenum);
379 void		GL_BlendFunction(GLenum sfactor, GLenum dfactor);
380 void		GL_ShadeModel(GLenum mode);
381 
382 void		GL_Stencil(qboolean enable);
383 void		GL_Overbright(qboolean enable);
384 
385 void		R_PushDlights(void);
386 void		R_MaxColorVec(vec3_t color);
387 void		R_LightPoint(vec3_t p, vec3_t color);
388 void		VLight_Init(void);
389 float		VLight_LerpLight(int index1, int index2, float ilerp, vec3_t dir, vec3_t angles, qboolean dlight);
390 
391 
392 void		R_SetupGL (void);
393 void		R_Clear   (void);
394 void		R_ShadowLight(vec3_t pos, vec3_t lightAdd);
395 void		R_LightPointDynamics(vec3_t p, vec3_t color, m_dlight_t * list, int *amount, int max);
396 
397 void		drawPlayerReflection(void);
398 void		GL_DrawRadar(void);
399 void		R_PreRenderDynamic(refdef_t * fd);
400 void		R_RenderGlares(refdef_t * fd);
401 
402 void		UpdateHardwareGamma(void);
403 
404 /* ==================================================================== */
405 
406 extern model_t *r_worldmodel;
407 
408 extern unsigned	d_8to24table[256];
409 
410 #ifndef QMAX
411 extern float	d_8to24tablef[256][3];
412 
413 #endif
414 
415 extern int	registration_sequence;
416 
417 int		R_Init     (void *hinstance, void *hWnd);
418 void		R_Shutdown(void);
419 
420 void		R_RenderView(refdef_t * fd);
421 void		R_RenderMirrorView(refdef_t * fd);
422 void		GL_ScreenShot_f(void);
423 void		GL_ScreenShot_JPG(void);
424 void		GL_ScreenShot_PNG(void);
425 void		R_DrawAliasModel(entity_t * e);
426 void		R_DrawAliasMD3Model(entity_t * e);
427 void		R_DrawAliasShadow(entity_t * e);
428 void		R_DrawBrushModel(entity_t * e);
429 void		R_DrawSpriteModel(entity_t * e);
430 void		R_DrawBeam(entity_t * e);
431 void		R_DrawWorld(void);
432 void		R_RenderDlights(void);
433 void		R_DrawAlphaSurfaces(void);
434 void		R_DrawAlphaSurfaces_Jitspoe(void);
435 void		R_RenderBrushPoly(msurface_t * fa);
436 void		R_InitParticleTexture(void);
437 void		Draw_InitLocal(void);
438 void		GL_SubdivideSurface(msurface_t * fa);
439 void		GL_SubdivideLightmappedSurface(msurface_t * fa, float subdivide_size);	/* Heffo surface subdivision */
440 qboolean	R_CullBox(vec3_t mins, vec3_t maxs);
441 void		R_RotateForEntity(entity_t * e);
442 void		R_MarkLeaves(void);
443 void		MYgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); /* MPO */
444 double		calc_wave(GLfloat x, GLfloat y);	/* Dukey */
445 
446 glpoly_t       *WaterWarpPolyVerts(glpoly_t * p);
447 void		EmitWaterPolys(msurface_t * fa);
448 void		R_AddSkySurface(msurface_t * fa);
449 void		R_ClearSkyBox(void);
450 void		R_DrawSkyBox(void);
451 void		R_MarkLights(dlight_t * light, int bit, mnode_t * node);
452 void		R_MarkStains(dlight_t * light, int bit, mnode_t * node);
453 void		GL_ClearDecals(void);
454 void		R_AddDecals(void);
455 void		R_Decals_Init(void);
456 void		R_AddDecal(vec3_t origin, vec3_t dir, float red, float green, float blue, float alpha,
457 				float size, int type, int flags, float angle);
458 
459 
460 /* gl_blooms.c  */
461 void		R_BloomBlend(refdef_t * fd);
462 void		R_InitBloomTextures(void);
463 
464 void		Draw_GetPicSize(int *w, int *h, char *name);
465 void		Draw_Pic  (int x, int y, char *name, float alpha);
466 void		Draw_StretchPic(int x, int y, int w, int h, char *name, float alpha);
467 void		Draw_Char (int x, int y, int num, int alpha);
468 void		Draw_TileClear(int x, int y, int w, int h, char *name);
469 void		Draw_Fill (int x, int y, int w, int h, int c);
470 void		Draw_FadeScreen(void);
471 void		Draw_FadeBox(int x, int y, int w, int h, float alpha);
472 void		Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte * data);
473 image_t        *Draw_FindPic(char *name);	/* MPO need this so we can call this method in gl_refl.c */
474 
475 void		R_BeginFrame(float camera_separation);
476 void		R_SwapBuffers(int);
477 void		R_SetPalette(const unsigned char *palette);
478 
479 int		Draw_GetPalette(void);
480 
481 void		GL_ResampleTexture(unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight);
482 
483 struct image_s *R_RegisterSkin(char *name);
484 
485 void		LoadPCX   (char *filename, byte ** pic, byte ** palette, int *width, int *height);
486 void		LoadTGA   (char *filename, byte ** pic, int *width, int *height);
487 void		LoadJPG   (char *filename, byte ** pic, int *width, int *height);
488 void		LoadPNG   (char *filename, byte ** pic, int *width, int *height);
489 
490 
491 image_t        *GL_LoadPic(char *name, byte * pic, int width, int height, imagetype_t type, int bits);
492 image_t        *GL_FindImage(char *name, imagetype_t type);
493 void		GL_TextureMode(char *string);
494 void		GL_ImageList_f(void);
495 
496 void		GL_SetTexturePalette(unsigned palette[256]);
497 
498 void		GL_InitImages(void);
499 void		GL_ShutdownImages(void);
500 
501 void		GL_FreeUnusedImages(void);
502 
503 void		GL_TextureAlphaMode(char *string);
504 void		GL_TextureSolidMode(char *string);
505 
506 void		R_ApplyStains(void);
507 void		R_StainNode(stain_t * st, mnode_t * node);
508 
509 void		R_RenderFlares(void);
510 void		R_RenderFlare(flare_t *light);
511 void		GL_AddFlareSurface(msurface_t * surf);
512 
513 
514 /*
515  * * GL extension emulation functions
516  */
517 #ifdef QMAX
518 void		GL_DrawParticles(int num_particles, qboolean inWater);
519 #else
520 void		GL_DrawParticles(int n, const particle_t particles[], const unsigned colortable[768]);
521 #endif
522 
523 /*
524  * * GL config stuff
525  */
526 #define GL_RENDERER_VOODOO		0x00000001
527 #define GL_RENDERER_VOODOO2   		0x00000002
528 #define GL_RENDERER_VOODOO_RUSH		0x00000004
529 #define GL_RENDERER_BANSHEE		0x00000008
530 #define GL_RENDERER_3DFX		0x0000000F
531 
532 #define GL_RENDERER_PCX1		0x00000010
533 #define GL_RENDERER_PCX2		0x00000020
534 #define GL_RENDERER_PMX			0x00000040
535 #define GL_RENDERER_POWERVR		0x00000070
536 
537 #define GL_RENDERER_PERMEDIA2		0x00000100
538 #define GL_RENDERER_GLINT_MX		0x00000200
539 #define GL_RENDERER_GLINT_TX		0x00000400
540 #define GL_RENDERER_3DLABS_MISC		0x00000800
541 #define GL_RENDERER_3DLABS		0x00000F00
542 
543 #define GL_RENDERER_REALIZM		0x00001000
544 #define GL_RENDERER_REALIZM2		0x00002000
545 #define GL_RENDERER_INTERGRAPH		0x00003000
546 
547 #define GL_RENDERER_3DPRO		0x00004000
548 #define GL_RENDERER_REAL3D		0x00008000
549 #define GL_RENDERER_RIVA128		0x00010000
550 #define GL_RENDERER_DYPIC		0x00020000
551 
552 #define GL_RENDERER_V1000		0x00040000
553 #define GL_RENDERER_V2100		0x00080000
554 #define GL_RENDERER_V2200		0x00100000
555 #define GL_RENDERER_RENDITION		0x001C0000
556 
557 #define GL_RENDERER_O2          	0x00100000
558 #define GL_RENDERER_IMPACT      	0x00200000
559 #define GL_RENDERER_RE			0x00400000
560 #define GL_RENDERER_IR			0x00800000
561 #define GL_RENDERER_SGI			0x00F00000
562 
563 #define GL_RENDERER_MCD			0x01000000
564 #define GL_RENDERER_OTHER		0x80000000
565 
566 typedef struct {
567 	int		renderer;
568 	const char     *renderer_string;
569 	const char     *vendor_string;
570 	const char     *version_string;
571 	const char     *extensions_string;
572 
573 	qboolean	allow_cds;
574 
575 	qboolean	mtexcombine;
576 	qboolean	NV_texshaders;
577 	qboolean	anisotropic;
578 	float		max_anisotropy;
579 	qboolean	GL_EXT_nv_multisample_filter_hint;
580 } glconfig_t;
581 
582 #define GLSTATE_DISABLE_ALPHATEST	if (gl_state.alpha_test) { qglDisable(GL_ALPHA_TEST); gl_state.alpha_test=false; }
583 #define GLSTATE_ENABLE_ALPHATEST	if (!gl_state.alpha_test) { qglEnable(GL_ALPHA_TEST); gl_state.alpha_test=true; }
584 
585 #define GLSTATE_DISABLE_BLEND		if (gl_state.blend) { qglDisable(GL_BLEND); gl_state.blend=false; }
586 #define GLSTATE_ENABLE_BLEND		if (!gl_state.blend) { qglEnable(GL_BLEND); gl_state.blend=true; }
587 
588 #define GLSTATE_DISABLE_TEXGEN		if (gl_state.texgen) { qglDisable(GL_TEXTURE_GEN_S); qglDisable(GL_TEXTURE_GEN_T); qglDisable(GL_TEXTURE_GEN_R); gl_state.texgen=false; }
589 #define GLSTATE_ENABLE_TEXGEN		if (!gl_state.texgen) { qglEnable(GL_TEXTURE_GEN_S); qglEnable(GL_TEXTURE_GEN_T); qglEnable(GL_TEXTURE_GEN_R); gl_state.texgen=true; }
590 
591 
592 typedef struct {
593 	float		inverse_intensity;
594 	qboolean	fullscreen;
595 
596 	int		prev_mode;
597 
598 	unsigned char  *d_16to8table;
599 
600 	int		lightmap_textures;
601 
602 	int		currenttextures[3];	/* Dukey was 2  */
603 	int		currenttmu;
604 
605 	float		camera_separation;
606 	qboolean	stereo_enabled;
607 
608 	qboolean	alpha_test;
609 	qboolean	blend;
610 	qboolean	texgen;
611 
612 	qboolean	reg_combiners;
613 	qboolean	sgis_mipmap;
614 	unsigned int	dst_texture;
615 	qboolean	tex_rectangle;
616 
617 	qboolean	texture_compression;	/* Heffo - ARB Texture Compression */
618 	int		maxtexsize;
619 
620 	unsigned char	originalRedGammaTable[256];
621 	unsigned char	originalGreenGammaTable[256];
622 	unsigned char	originalBlueGammaTable[256];
623 
624 	qboolean	hwgamma;
625 	qboolean	fragment_program;	/* MPO does gfx support fragment programs */
626 	qboolean	nv_fog;
627 
628 } glstate_t;
629 
630 extern glconfig_t gl_config;
631 extern glstate_t gl_state;
632 
633 /* vertex arrays */
634 
635 #define MAX_ARRAY MAX_PARTICLES*4
636 
637 #define VA_SetElem2(v,a,b)      ((v)[0]=(a),(v)[1]=(b))
638 #define VA_SetElem3(v,a,b,c)    ((v)[0]=(a),(v)[1]=(b),(v)[2]=(c))
639 #define VA_SetElem4(v,a,b,c,d)  ((v)[0]=(a),(v)[1]=(b),(v)[2]=(c),(v)[3]=(d))
640 
641 extern float	tex_array[MAX_ARRAY][2];
642 extern float	vert_array[MAX_ARRAY][3];
643 extern float	col_array[MAX_ARRAY][4];
644 
645 extern qboolean inlava;
646 extern qboolean inslime;
647 extern qboolean inwater;
648 
649 
650 /*
651  * ====================================================================
652  *
653  * IMPORTED FUNCTIONS
654  *
655  * ====================================================================
656  */
657 
658 extern refimport_t ri;
659 
660 
661 /*
662  * ====================================================================
663  *
664  * IMPLEMENTATION SPECIFIC FUNCTIONS
665  *
666  * ====================================================================
667  */
668 
669 #define		MAX_WALL_LIGHTS	1024
670 
671 void		GLimp_BeginFrame(float camera_separation);
672 void		GLimp_EndFrame(void);
673 int		GLimp_Init (void *hinstance, void *hWnd);
674 void		GLimp_Shutdown(void);
675 int		GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen);
676 void		GLimp_AppActivate(qboolean active);
677 void		GLimp_EnableLogging(qboolean enable);
678 void		GLimp_LogNewFrame(void);
679 
680 extern int	g_numGlLights;
681 extern int	numberOfWallLights;
682 extern wallLight_t *wallLightArray[MAX_WALL_LIGHTS];	/* array of pointers :) */
683 
684 /* sul */
685 #define MAX_RADAR_ENTS 128
686 typedef struct RadarEnt_s {
687 	float		color    [4];
688 	vec3_t		org;
689 } RadarEnt_t;
690 
691 int		numRadarEnts;
692 RadarEnt_t	RadarEnts[MAX_RADAR_ENTS];
693 
694 #endif /* _GL_LOCAL_H_ */
695