added support for GL_ARB_texture_env_combine, currently only used on wall rendering...
[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 // disable data conversion warnings
21
22 #ifdef _MSC_VER
23 //#pragma warning(disable : 4244)     // MIPS
24 //#pragma warning(disable : 4136)     // X86
25 //#pragma warning(disable : 4051)     // ALPHA
26 #pragma warning(disable : 4244)     // LordHavoc: MSVC++ 4 x86, double/float
27 #pragma warning(disable : 4305)         // LordHavoc: MSVC++ 6 x86, double/float
28 #pragma warning(disable : 4018)         // LordHavoc: MSVC++ 4 x86, signed/unsigned mismatch
29 #endif
30
31 #ifdef _WIN32
32 #include <windows.h>
33 #define strcasecmp stricmp
34 #define strncasecmp strnicmp
35 #endif
36
37 #include <GL/gl.h>
38 //#include <GL/glu.h>
39
40 extern qboolean isG200;
41 extern qboolean isRagePro;
42 extern qboolean gl_mtexable;
43 extern qboolean gl_supportslockarrays;
44
45 extern void GL_BeginRendering (int *x, int *y, int *width, int *height);
46 extern void GL_EndRendering (void);
47
48 extern  float   gldepthmin, gldepthmax;
49
50 typedef struct
51 {
52         float   x, y, z;
53         float   s, t;
54         float   r, g, b;
55 } glvert_t;
56
57 extern glvert_t glv;
58
59 extern  int glx, gly, glwidth, glheight;
60
61 // r_local.h -- private refresh defs
62
63 #define ALIAS_BASE_SIZE_RATIO           (1.0 / 11.0)
64                                         // normalizing factor so player model works out to about
65                                         //  1 pixel per triangle
66 #define MAX_LBM_HEIGHT          480
67
68 #define BACKFACE_EPSILON        0.01
69
70
71 extern void R_TimeRefresh_f (void);
72
73 //====================================================
74
75
76 extern  qboolean        r_cache_thrash;         // compatability
77 extern  vec3_t          modelorg, r_entorigin;
78 extern  entity_t        *currententity;
79 extern  int                     r_framecount;
80 extern  mplane_t        frustum[4];
81 extern  int             c_brush_polys, c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights;
82
83
84 //
85 // view origin
86 //
87 extern  vec3_t  vup;
88 extern  vec3_t  vpn;
89 extern  vec3_t  vright;
90 extern  vec3_t  r_origin;
91
92 //
93 // screen size info
94 //
95 extern  refdef_t        r_refdef;
96 extern  mleaf_t         *r_viewleaf, *r_oldviewleaf;
97 extern  unsigned short  d_lightstylevalue[256]; // 8.8 fraction of base light value
98
99 extern  qboolean        envmap;
100
101 extern  cvar_t  r_drawentities;
102 extern  cvar_t  r_drawviewmodel;
103 extern  cvar_t  r_speeds;
104 extern  cvar_t  r_fullbright;
105 extern  cvar_t  r_wateralpha;
106 extern  cvar_t  r_dynamic;
107 extern  cvar_t  r_waterripple;
108
109 extern  float   r_world_matrix[16];
110
111 extern  const char *gl_vendor;
112 extern  const char *gl_renderer;
113 extern  const char *gl_version;
114 extern  const char *gl_extensions;
115
116 // Multitexture
117 #define    TEXTURE0_SGIS                                0x835E
118 #define    TEXTURE1_SGIS                                0x835F
119
120 #ifndef _WIN32
121 #define APIENTRY /* */
122 #endif
123
124 // LordHavoc: ARB multitexure support
125 extern int              gl_mtex_enum;
126
127 // for platforms (wgl) that do not use GLAPIENTRY
128 #ifndef GLAPIENTRY
129 #define GLAPIENTRY APIENTRY
130 #endif
131
132 // multitexture
133 extern void (GLAPIENTRY *qglMTexCoord2f) (GLenum, GLfloat, GLfloat);
134 extern void (GLAPIENTRY *qglSelectTexture) (GLenum);
135 extern void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
136 extern void (GLAPIENTRY *qglUnlockArraysEXT) (void);
137
138
139 #ifndef GL_ACTIVE_TEXTURE_ARB
140 // GL_ARB_multitexture
141 #define GL_ACTIVE_TEXTURE_ARB                   0x84E0
142 #define GL_CLIENT_ACTIVE_TEXTURE_ARB    0x84E1
143 #define GL_MAX_TEXTURES_UNITS_ARB               0x84E2
144 #define GL_TEXTURE0_ARB                                 0x84C0
145 #define GL_TEXTURE1_ARB                                 0x84C1
146 #define GL_TEXTURE2_ARB                                 0x84C2
147 #define GL_TEXTURE3_ARB                                 0x84C3
148 #define GL_TEXTURE4_ARB                                 0x84C4
149 #define GL_TEXTURE5_ARB                                 0x84C5
150 #define GL_TEXTURE6_ARB                                 0x84C6
151 #define GL_TEXTURE7_ARB                                 0x84C7
152 #define GL_TEXTURE8_ARB                                 0x84C8
153 #define GL_TEXTURE9_ARB                                 0x84C9
154 #define GL_TEXTURE10_ARB                                0x84CA
155 #define GL_TEXTURE11_ARB                                0x84CB
156 #define GL_TEXTURE12_ARB                                0x84CC
157 #define GL_TEXTURE13_ARB                                0x84CD
158 #define GL_TEXTURE14_ARB                                0x84CE
159 #define GL_TEXTURE15_ARB                                0x84CF
160 #define GL_TEXTURE16_ARB                                0x84D0
161 #define GL_TEXTURE17_ARB                                0x84D1
162 #define GL_TEXTURE18_ARB                                0x84D2
163 #define GL_TEXTURE19_ARB                                0x84D3
164 #define GL_TEXTURE20_ARB                                0x84D4
165 #define GL_TEXTURE21_ARB                                0x84D5
166 #define GL_TEXTURE22_ARB                                0x84D6
167 #define GL_TEXTURE23_ARB                                0x84D7
168 #define GL_TEXTURE24_ARB                                0x84D8
169 #define GL_TEXTURE25_ARB                                0x84D9
170 #define GL_TEXTURE26_ARB                                0x84DA
171 #define GL_TEXTURE27_ARB                                0x84DB
172 #define GL_TEXTURE28_ARB                                0x84DC
173 #define GL_TEXTURE29_ARB                                0x84DD
174 #define GL_TEXTURE30_ARB                                0x84DE
175 #define GL_TEXTURE31_ARB                                0x84DF
176 #endif
177
178 #ifndef GL_COMBINE_ARB
179 // GL_ARB_texture_env_combine
180 #define GL_COMBINE_ARB                                  0x8570
181 #define GL_COMBINE_RGB_ARB                              0x8571
182 #define GL_COMBINE_ALPHA_ARB                    0x8572
183 #define GL_SOURCE0_RGB_ARB                              0x8580
184 #define GL_SOURCE1_RGB_ARB                              0x8581
185 #define GL_SOURCE2_RGB_ARB                              0x8582
186 #define GL_SOURCE0_ALPHA_ARB                    0x8588
187 #define GL_SOURCE1_ALPHA_ARB                    0x8589
188 #define GL_SOURCE2_ALPHA_ARB                    0x858A
189 #define GL_OPERAND0_RGB_ARB                             0x8590
190 #define GL_OPERAND1_RGB_ARB                             0x8591
191 #define GL_OPERAND2_RGB_ARB                             0x8592
192 #define GL_OPERAND0_ALPHA_ARB                   0x8598
193 #define GL_OPERAND1_ALPHA_ARB                   0x8599
194 #define GL_OPERAND2_ALPHA_ARB                   0x859A
195 #define GL_RGB_SCALE_ARB                                0x8573
196 #define GL_ADD_SIGNED_ARB                               0x8574
197 #define GL_INTERPOLATE_ARB                              0x8575
198 #define GL_SUBTRACT_ARB                                 0x84E7
199 #define GL_CONSTANT_ARB                                 0x8576
200 #define GL_PRIMARY_COLOR_ARB                    0x8577
201 #define GL_PREVIOUS_ARB                                 0x8578
202 #endif
203
204 extern qboolean gl_combine_extension;
205 extern cvar_t gl_combine;
206
207 #ifdef WIN32
208 #else
209 //#ifndef MESA
210 //extern void (GLAPIENTRY *glColorTableEXT)(int, int, int, int, int, const void*);
211 //#endif
212
213 #endif