Clean up and repair of the run time linking, does NOT work until deek

commits his gl_funcs.c.
This commit is contained in:
Zephaniah E. Hull 2001-06-26 02:26:46 +00:00
parent 3fa3ab59a9
commit 908d265212
23 changed files with 524 additions and 521 deletions

View file

@ -32,7 +32,7 @@
#include "QF/GL/types.h" #include "QF/GL/types.h"
#include "QF/qtypes.h" #include "QF/qtypes.h"
#define QFGL_NEED(ret, name, args) extern ret (* name) args #define QFGL_NEED(ret, name, args) extern ret (* qf##name) args
#include "QF/GL/qf_funcs_list.h" #include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED #undef QFGL_NEED

View file

@ -464,8 +464,10 @@ Cache_TryAlloc (int size, qboolean nobottom)
// is the cache completely empty? // is the cache completely empty?
if (!nobottom && cache_head.prev == &cache_head) { if (!nobottom && cache_head.prev == &cache_head) {
if (hunk_size - hunk_high_used - hunk_low_used < size) if (hunk_size - hunk_high_used - hunk_low_used < size) {
Sys_Error ("Cache_TryAlloc: %i is greater then free hunk", size); Con_Printf ("Cache_TryAlloc: %i is greater then free hunk", size);
return NULL;
}
new = (cache_system_t *) (hunk_base + hunk_low_used); new = (cache_system_t *) (hunk_base + hunk_low_used);
memset (new, 0, sizeof (*new)); memset (new, 0, sizeof (*new));

View file

@ -246,7 +246,7 @@ Draw_Init (void)
GLint texSize; GLint texSize;
// Some cards have a texture size limit. // Some cards have a texture size limit.
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize); qfglGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
Cvar_Set (gl_max_size, va("%d", texSize)); Cvar_Set (gl_max_size, va("%d", texSize));
Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality."); Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality.");
@ -264,8 +264,8 @@ Draw_Init (void)
char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1); // 1999-12-27 Conwidth/height charset fix by TcT char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1); // 1999-12-27 Conwidth/height charset fix by TcT
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true, 1); cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true, 1);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// save a texture slot for translated picture // save a texture slot for translated picture
translate_texture = texture_extension_number++; translate_texture = texture_extension_number++;
@ -307,18 +307,18 @@ Draw_Character8 (int x, int y, int num)
fcol = col * 0.0625; fcol = col * 0.0625;
size = 0.0625; size = 0.0625;
glBindTexture (GL_TEXTURE_2D, char_texture); qfglBindTexture (GL_TEXTURE_2D, char_texture);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (fcol, frow); qfglTexCoord2f (fcol, frow);
glVertex2f (x, y); qfglVertex2f (x, y);
glTexCoord2f (fcol + size, frow); qfglTexCoord2f (fcol + size, frow);
glVertex2f (x + 8, y); qfglVertex2f (x + 8, y);
glTexCoord2f (fcol + size, frow + size); qfglTexCoord2f (fcol + size, frow + size);
glVertex2f (x + 8, y + 8); qfglVertex2f (x + 8, y + 8);
glTexCoord2f (fcol, frow + size); qfglTexCoord2f (fcol, frow + size);
glVertex2f (x, y + 8); qfglVertex2f (x, y + 8);
glEnd (); qfglEnd ();
} }
@ -366,20 +366,20 @@ Draw_Crosshair (int swap)
y = scr_vrect.y + scr_vrect.height / 2 - 3 + cl_crossy->int_val; y = scr_vrect.y + scr_vrect.height / 2 - 3 + cl_crossy->int_val;
pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val]; pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val];
glColor4ubv (pColor); qfglColor4ubv (pColor);
glBindTexture (GL_TEXTURE_2D, cs_texture); qfglBindTexture (GL_TEXTURE_2D, cs_texture);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (0, 0); qfglTexCoord2f (0, 0);
glVertex2f (x - 4, y - 4); qfglVertex2f (x - 4, y - 4);
glTexCoord2f (1, 0); qfglTexCoord2f (1, 0);
glVertex2f (x + 12, y - 4); qfglVertex2f (x + 12, y - 4);
glTexCoord2f (1, 1); qfglTexCoord2f (1, 1);
glVertex2f (x + 12, y + 12); qfglVertex2f (x + 12, y + 12);
glTexCoord2f (0, 1); qfglTexCoord2f (0, 1);
glVertex2f (x - 4, y + 12); qfglVertex2f (x - 4, y + 12);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
break; break;
} }
} }
@ -392,17 +392,17 @@ Draw_Pic (int x, int y, qpic_t *pic)
gl = (glpic_t *) pic->data; gl = (glpic_t *) pic->data;
glBindTexture (GL_TEXTURE_2D, gl->texnum); qfglBindTexture (GL_TEXTURE_2D, gl->texnum);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (0, 0); qfglTexCoord2f (0, 0);
glVertex2f (x, y); qfglVertex2f (x, y);
glTexCoord2f (1, 0); qfglTexCoord2f (1, 0);
glVertex2f (x + pic->width, y); qfglVertex2f (x + pic->width, y);
glTexCoord2f (1, 1); qfglTexCoord2f (1, 1);
glVertex2f (x + pic->width, y + pic->height); qfglVertex2f (x + pic->width, y + pic->height);
glTexCoord2f (0, 1); qfglTexCoord2f (0, 1);
glVertex2f (x, y + pic->height); qfglVertex2f (x, y + pic->height);
glEnd (); qfglEnd ();
} }
@ -421,19 +421,19 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
newtl = (float) srcy / (float) pic->height; newtl = (float) srcy / (float) pic->height;
newth = newtl + (float) height / (float) pic->height; newth = newtl + (float) height / (float) pic->height;
glColor3f (0.8, 0.8, 0.8); qfglColor3f (0.8, 0.8, 0.8);
glBindTexture (GL_TEXTURE_2D, gl->texnum); qfglBindTexture (GL_TEXTURE_2D, gl->texnum);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (newsl, newtl); qfglTexCoord2f (newsl, newtl);
glVertex2f (x, y); qfglVertex2f (x, y);
glTexCoord2f (newsh, newtl); qfglTexCoord2f (newsh, newtl);
glVertex2f (x + width, y); qfglVertex2f (x + width, y);
glTexCoord2f (newsh, newth); qfglTexCoord2f (newsh, newth);
glVertex2f (x + width, y + height); qfglVertex2f (x + width, y + height);
glTexCoord2f (newsl, newth); qfglTexCoord2f (newsl, newth);
glVertex2f (x, y + height); qfglVertex2f (x, y + height);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -450,7 +450,7 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
byte *src; byte *src;
int p; int p;
glBindTexture (GL_TEXTURE_2D, translate_texture); qfglBindTexture (GL_TEXTURE_2D, translate_texture);
c = pic->width * pic->height; c = pic->width * pic->height;
@ -466,24 +466,24 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
} }
} }
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA, qfglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans); GL_UNSIGNED_BYTE, trans);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glColor3f (0.8, 0.8, 0.8); qfglColor3f (0.8, 0.8, 0.8);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (0, 0); qfglTexCoord2f (0, 0);
glVertex2f (x, y); qfglVertex2f (x, y);
glTexCoord2f (1, 0); qfglTexCoord2f (1, 0);
glVertex2f (x + pic->width, y); qfglVertex2f (x + pic->width, y);
glTexCoord2f (1, 1); qfglTexCoord2f (1, 1);
glVertex2f (x + pic->width, y + pic->height); qfglVertex2f (x + pic->width, y + pic->height);
glTexCoord2f (0, 1); qfglTexCoord2f (0, 1);
glVertex2f (x, y + pic->height); qfglVertex2f (x, y + pic->height);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -512,16 +512,16 @@ Draw_ConsoleBackground (int lines)
static float xfactor = .3f; static float xfactor = .3f;
static float xstep = .005f; static float xstep = .005f;
glPushMatrix (); qfglPushMatrix ();
glMatrixMode (GL_TEXTURE); qfglMatrixMode (GL_TEXTURE);
glPushMatrix (); qfglPushMatrix ();
glLoadIdentity (); qfglLoadIdentity ();
xangle += gl_conspin->value; xangle += gl_conspin->value;
xfactor += xstep; xfactor += xstep;
if (xfactor > 8 || xfactor < .3f) if (xfactor > 8 || xfactor < .3f)
xstep = -xstep; xstep = -xstep;
glRotatef (xangle, 0, 0, 1); qfglRotatef (xangle, 0, 0, 1);
glScalef (xfactor, xfactor, xfactor); qfglScalef (xfactor, xfactor, xfactor);
} }
// slide console up/down or stretch it? // slide console up/down or stretch it?
if (gl_constretch->int_val) if (gl_constretch->int_val)
@ -537,35 +537,35 @@ Draw_ConsoleBackground (int lines)
alpha = (float) (gl_conalpha->value * lines) / y; alpha = (float) (gl_conalpha->value * lines) / y;
} }
glColor4f (0.8, 0.8, 0.8, alpha); qfglColor4f (0.8, 0.8, 0.8, alpha);
// draw the console texture // draw the console texture
glBindTexture (GL_TEXTURE_2D, gl->texnum); qfglBindTexture (GL_TEXTURE_2D, gl->texnum);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (0, 0 + ofs); qfglTexCoord2f (0, 0 + ofs);
glVertex2f (0, 0); qfglVertex2f (0, 0);
glTexCoord2f (1, 0 + ofs); qfglTexCoord2f (1, 0 + ofs);
glVertex2f (vid.conwidth, 0); qfglVertex2f (vid.conwidth, 0);
glTexCoord2f (1, 1); qfglTexCoord2f (1, 1);
glVertex2f (vid.conwidth, lines); qfglVertex2f (vid.conwidth, lines);
glTexCoord2f (0, 1); qfglTexCoord2f (0, 1);
glVertex2f (0, lines); qfglVertex2f (0, lines);
glEnd (); qfglEnd ();
// turn off alpha blending // turn off alpha blending
if (alpha < 1.0) { if (alpha < 1.0) {
glColor3f (0.8, 0.8, 0.8); qfglColor3f (0.8, 0.8, 0.8);
} }
if (gl_conspin->value) { if (gl_conspin->value) {
glPopMatrix (); qfglPopMatrix ();
glMatrixMode (GL_MODELVIEW); qfglMatrixMode (GL_MODELVIEW);
glPopMatrix (); qfglPopMatrix ();
} }
Draw_AltString8 (vid.conwidth - strlen (cl_verstring->string) * 8 - 11, Draw_AltString8 (vid.conwidth - strlen (cl_verstring->string) * 8 - 11,
lines - 14, cl_verstring->string); lines - 14, cl_verstring->string);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -578,19 +578,19 @@ Draw_ConsoleBackground (int lines)
void void
Draw_TileClear (int x, int y, int w, int h) Draw_TileClear (int x, int y, int w, int h)
{ {
glColor3f (0.8, 0.8, 0.8); qfglColor3f (0.8, 0.8, 0.8);
glBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data); qfglBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (x / 64.0, y / 64.0); qfglTexCoord2f (x / 64.0, y / 64.0);
glVertex2f (x, y); qfglVertex2f (x, y);
glTexCoord2f ((x + w) / 64.0, y / 64.0); qfglTexCoord2f ((x + w) / 64.0, y / 64.0);
glVertex2f (x + w, y); qfglVertex2f (x + w, y);
glTexCoord2f ((x + w) / 64.0, (y + h) / 64.0); qfglTexCoord2f ((x + w) / 64.0, (y + h) / 64.0);
glVertex2f (x + w, y + h); qfglVertex2f (x + w, y + h);
glTexCoord2f (x / 64.0, (y + h) / 64.0); qfglTexCoord2f (x / 64.0, (y + h) / 64.0);
glVertex2f (x, y + h); qfglVertex2f (x, y + h);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -602,20 +602,20 @@ Draw_TileClear (int x, int y, int w, int h)
void void
Draw_Fill (int x, int y, int w, int h, int c) Draw_Fill (int x, int y, int w, int h, int c)
{ {
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0, qfglColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0,
vid_basepal[c * 3 + 2] / 255.0); vid_basepal[c * 3 + 2] / 255.0);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glVertex2f (x, y); qfglVertex2f (x, y);
glVertex2f (x + w, y); qfglVertex2f (x + w, y);
glVertex2f (x + w, y + h); qfglVertex2f (x + w, y + h);
glVertex2f (x, y + h); qfglVertex2f (x, y + h);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
} }
@ -625,18 +625,18 @@ Draw_Fill (int x, int y, int w, int h, int c)
void void
Draw_FadeScreen (void) Draw_FadeScreen (void)
{ {
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
glColor4f (0, 0, 0, 0.7); qfglColor4f (0, 0, 0, 0.7);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glVertex2f (0, 0); qfglVertex2f (0, 0);
glVertex2f (vid.width, 0); qfglVertex2f (vid.width, 0);
glVertex2f (vid.width, vid.height); qfglVertex2f (vid.width, vid.height);
glVertex2f (0, vid.height); qfglVertex2f (0, vid.height);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
Sbar_Changed (); Sbar_Changed ();
} }
@ -677,17 +677,17 @@ Draw_EndDisc (void)
void void
GL_Set2D (void) GL_Set2D (void)
{ {
glViewport (glx, gly, glwidth, glheight); qfglViewport (glx, gly, glwidth, glheight);
glMatrixMode (GL_PROJECTION); qfglMatrixMode (GL_PROJECTION);
glLoadIdentity (); qfglLoadIdentity ();
glOrtho (0, vid.width, vid.height, 0, -99999, 99999); qfglOrtho (0, vid.width, vid.height, 0, -99999, 99999);
glMatrixMode (GL_MODELVIEW); qfglMatrixMode (GL_MODELVIEW);
glLoadIdentity (); qfglLoadIdentity ();
glDisable (GL_DEPTH_TEST); qfglDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE); qfglDisable (GL_CULL_FACE);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }

View file

@ -166,12 +166,12 @@ R_DrawFire (fire_t *f)
return; return;
} }
// we're not - draw it // we're not - draw it
glBegin (GL_TRIANGLE_FAN); qfglBegin (GL_TRIANGLE_FAN);
glColor3fv (f->color); qfglColor3fv (f->color);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
vec[i] = f->origin[i] - vpn[i] * radius; vec[i] = f->origin[i] - vpn[i] * radius;
glVertex3fv (vec); qfglVertex3fv (vec);
glColor3f (0.0, 0.0, 0.0); qfglColor3f (0.0, 0.0, 0.0);
// don't panic, this just draws a bubble... // don't panic, this just draws a bubble...
for (i = 16; i >= 0; i--) { for (i = 16; i >= 0; i--) {
@ -181,14 +181,14 @@ R_DrawFire (fire_t *f)
vec2[j] = f->owner[j] + (*b_cos * vright[j] vec2[j] = f->owner[j] + (*b_cos * vright[j]
+ vup[j] * (*b_sin)) * radius; + vup[j] * (*b_sin)) * radius;
} }
glVertex3fv (vec); qfglVertex3fv (vec);
glVertex3fv (vec2); qfglVertex3fv (vec2);
b_sin += 2; b_sin += 2;
b_cos += 2; b_cos += 2;
} }
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -206,9 +206,9 @@ R_UpdateFires (void)
if (!gl_fires->int_val) if (!gl_fires->int_val)
return; return;
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
glBlendFunc (GL_ONE, GL_ONE); qfglBlendFunc (GL_ONE, GL_ONE);
f = r_fires; f = r_fires;
for (i = 0; i < MAX_FIRES; i++, f++) { for (i = 0; i < MAX_FIRES; i++, f++) {
@ -218,7 +218,7 @@ R_UpdateFires (void)
R_DrawFire (f); R_DrawFire (f);
} }
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
} }

View file

@ -575,7 +575,7 @@ R_DrawParticles (void)
int activeparticles, maxparticle, j, k; int activeparticles, maxparticle, j, k;
// LordHavoc: particles should not affect zbuffer // LordHavoc: particles should not affect zbuffer
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
VectorScale (vup, 1.5, o_up); VectorScale (vup, 1.5, o_up);
VectorScale (vright, 1.5, o_right); VectorScale (vright, 1.5, o_right);
@ -660,8 +660,8 @@ R_DrawParticles (void)
varray[3].vertex[1] = part->org[1] + up_scale[1] - right_scale[1]; varray[3].vertex[1] = part->org[1] + up_scale[1] - right_scale[1];
varray[3].vertex[2] = part->org[2] + up_scale[2] - right_scale[2]; varray[3].vertex[2] = part->org[2] + up_scale[2] - right_scale[2];
glBindTexture (GL_TEXTURE_2D, part->tex); qfglBindTexture (GL_TEXTURE_2D, part->tex);
glDrawArrays (GL_QUADS, 0, 4); qfglDrawArrays (GL_QUADS, 0, 4);
} }
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@ -747,6 +747,6 @@ R_DrawParticles (void)
} }
numparticles = activeparticles; numparticles = activeparticles;
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
} }

View file

@ -83,10 +83,10 @@ GDT_InitDotParticleTexture (void)
} }
} }
part_tex_dot = texture_extension_number++; part_tex_dot = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_dot); qfglBindTexture (GL_TEXTURE_2D, part_tex_dot);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA, qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
} }
@ -115,10 +115,10 @@ GDT_InitSparkParticleTexture (void)
} }
} }
part_tex_spark = texture_extension_number++; part_tex_spark = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_spark); qfglBindTexture (GL_TEXTURE_2D, part_tex_spark);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA, qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
} }
@ -153,10 +153,10 @@ GDT_InitSmokeParticleTexture (void)
} }
} }
part_tex_smoke[i] = texture_extension_number++; part_tex_smoke[i] = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]); qfglBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA, qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
} }
} }
@ -197,10 +197,10 @@ GDT_InitSmokeRingParticleTexture (void)
} }
} }
part_tex_smoke_ring[i] = texture_extension_number++; part_tex_smoke_ring[i] = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]); qfglBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA, qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data); GL_UNSIGNED_BYTE, data);
} }
} }

View file

@ -122,22 +122,22 @@ R_LineGraph (int x, int y, int *h_vals, int count)
dest[0] = 0xff; dest[0] = 0xff;
} }
glBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]); qfglBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]);
GL_Upload8 (graph_texels[graph_index], graph_width[graph_index], s, 0, 1); GL_Upload8 (graph_texels[graph_index], graph_width[graph_index], s, 0, 1);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (0, 0); qfglTexCoord2f (0, 0);
glVertex2f (x, y); qfglVertex2f (x, y);
glTexCoord2f (1, 0); qfglTexCoord2f (1, 0);
glVertex2f (x + graph_width[graph_index], y); qfglVertex2f (x + graph_width[graph_index], y);
glTexCoord2f (1, 1); qfglTexCoord2f (1, 1);
glVertex2f (x + graph_width[graph_index], y - s); qfglVertex2f (x + graph_width[graph_index], y - s);
glTexCoord2f (0, 1); qfglTexCoord2f (0, 1);
glVertex2f (x, y - s); qfglVertex2f (x, y - s);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
graph_index = (graph_index + 1) % NUM_GRAPH_TEXTURES; graph_index = (graph_index + 1) % NUM_GRAPH_TEXTURES;
} }

View file

@ -129,9 +129,9 @@ R_RenderDlight (dlight_t *light)
return; return;
} }
glBegin (GL_TRIANGLE_FAN); qfglBegin (GL_TRIANGLE_FAN);
glColor3fv (light->color); qfglColor3fv (light->color);
VectorSubtract (r_origin, light->origin, v); VectorSubtract (r_origin, light->origin, v);
VectorNormalize (v); VectorNormalize (v);
@ -139,8 +139,8 @@ R_RenderDlight (dlight_t *light)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
v[i] = light->origin[i] + v[i] * rad; v[i] = light->origin[i] + v[i] * rad;
glVertex3fv (v); qfglVertex3fv (v);
glColor3f (0, 0, 0); qfglColor3f (0, 0, 0);
for (i = 16; i >= 0; i--) { for (i = 16; i >= 0; i--) {
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
@ -148,10 +148,10 @@ R_RenderDlight (dlight_t *light)
vup[j] * (*bub_sin)) * rad; vup[j] * (*bub_sin)) * rad;
bub_sin += 2; bub_sin += 2;
bub_cos += 2; bub_cos += 2;
glVertex3fv (v); qfglVertex3fv (v);
} }
glEnd (); qfglEnd ();
} }
@ -164,10 +164,10 @@ R_RenderDlights (void)
if (!gl_dlight_polyblend->int_val) if (!gl_dlight_polyblend->int_val)
return; return;
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
glBlendFunc (GL_ONE, GL_ONE); qfglBlendFunc (GL_ONE, GL_ONE);
glShadeModel (GL_SMOOTH); qfglShadeModel (GL_SMOOTH);
l = r_dlights; l = r_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
@ -177,11 +177,11 @@ R_RenderDlights (void)
} }
if (!gl_dlight_smooth->int_val) if (!gl_dlight_smooth->int_val)
glShadeModel (GL_FLAT); qfglShadeModel (GL_FLAT);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
} }

View file

@ -117,12 +117,12 @@ glrmain_init (void)
void void
R_RotateForEntity (entity_t *e) R_RotateForEntity (entity_t *e)
{ {
glTranslatef (e->origin[0], e->origin[1], e->origin[2]); qfglTranslatef (e->origin[0], e->origin[1], e->origin[2]);
glRotatef (e->angles[1], 0, 0, 1); qfglRotatef (e->angles[1], 0, 0, 1);
glRotatef (-e->angles[0], 0, 1, 0); qfglRotatef (-e->angles[0], 0, 1, 0);
// ZOID: fixed z angle // ZOID: fixed z angle
glRotatef (e->angles[2], 1, 0, 0); qfglRotatef (e->angles[2], 1, 0, 0);
} }
@ -193,34 +193,34 @@ R_DrawSpriteModel (entity_t *e)
right = vright; right = vright;
} }
glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum); qfglBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
glEnable (GL_ALPHA_TEST); qfglEnable (GL_ALPHA_TEST);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glTexCoord2f (0, 1); qfglTexCoord2f (0, 1);
VectorMA (e->origin, frame->down, up, point); VectorMA (e->origin, frame->down, up, point);
VectorMA (point, frame->left, right, point); VectorMA (point, frame->left, right, point);
glVertex3fv (point); qfglVertex3fv (point);
glTexCoord2f (0, 0); qfglTexCoord2f (0, 0);
VectorMA (e->origin, frame->up, up, point); VectorMA (e->origin, frame->up, up, point);
VectorMA (point, frame->left, right, point); VectorMA (point, frame->left, right, point);
glVertex3fv (point); qfglVertex3fv (point);
glTexCoord2f (1, 0); qfglTexCoord2f (1, 0);
VectorMA (e->origin, frame->up, up, point); VectorMA (e->origin, frame->up, up, point);
VectorMA (point, frame->right, right, point); VectorMA (point, frame->right, right, point);
glVertex3fv (point); qfglVertex3fv (point);
glTexCoord2f (1, 1); qfglTexCoord2f (1, 1);
VectorMA (e->origin, frame->down, up, point); VectorMA (e->origin, frame->down, up, point);
VectorMA (point, frame->right, right, point); VectorMA (point, frame->right, right, point);
glVertex3fv (point); qfglVertex3fv (point);
glEnd (); qfglEnd ();
glDisable (GL_ALPHA_TEST); qfglDisable (GL_ALPHA_TEST);
} }
@ -263,24 +263,24 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
order = (int *) ((byte *) paliashdr + paliashdr->commands); order = (int *) ((byte *) paliashdr + paliashdr->commands);
if (modelalpha != 1.0) if (modelalpha != 1.0)
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
if (fb) { if (fb) {
glColor4f (1, 1, 1, modelalpha); qfglColor4f (1, 1, 1, modelalpha);
} }
while ((count = *order++)) { while ((count = *order++)) {
// get the vertex count and primitive type // get the vertex count and primitive type
if (count < 0) { if (count < 0) {
count = -count; count = -count;
glBegin (GL_TRIANGLE_FAN); qfglBegin (GL_TRIANGLE_FAN);
} else { } else {
glBegin (GL_TRIANGLE_STRIP); qfglBegin (GL_TRIANGLE_STRIP);
} }
do { do {
// texture coordinates come from the draw list // texture coordinates come from the draw list
glTexCoord2f (((float *) order)[0], ((float *) order)[1]); qfglTexCoord2f (((float *) order)[0], ((float *) order)[1]);
order += 2; order += 2;
if (!fb) { if (!fb) {
@ -288,21 +288,21 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
l = shadedots[verts->lightnormalindex] * shadelight; l = shadedots[verts->lightnormalindex] * shadelight;
// LordHavoc: cleanup after Endy // LordHavoc: cleanup after Endy
glColor4f (shadecolor[0] * l, shadecolor[1] * l, qfglColor4f (shadecolor[0] * l, shadecolor[1] * l,
shadecolor[2] * l, modelalpha); shadecolor[2] * l, modelalpha);
} }
glVertex3f (verts->v[0], verts->v[1], verts->v[2]); qfglVertex3f (verts->v[0], verts->v[1], verts->v[2]);
verts++; verts++;
} while (--count); } while (--count);
glEnd (); qfglEnd ();
} }
if (modelalpha != 1.0) if (modelalpha != 1.0)
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -333,10 +333,10 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
order = (int *) ((byte *) paliashdr + paliashdr->commands); order = (int *) ((byte *) paliashdr + paliashdr->commands);
if (modelalpha != 1.0) if (modelalpha != 1.0)
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
if (fb) { // don't do this in the loop, it doesn't change if (fb) { // don't do this in the loop, it doesn't change
glColor4f (1, 1, 1, modelalpha); qfglColor4f (1, 1, 1, modelalpha);
} }
lerp = 1 - blend; lerp = 1 - blend;
@ -344,14 +344,14 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
if (count < 0) { if (count < 0) {
count = -count; count = -count;
glBegin (GL_TRIANGLE_FAN); qfglBegin (GL_TRIANGLE_FAN);
} else { } else {
glBegin (GL_TRIANGLE_STRIP); qfglBegin (GL_TRIANGLE_STRIP);
} }
do { do {
// texture coordinates come from the draw list // texture coordinates come from the draw list
glTexCoord2f (((float *) order)[0], ((float *) order)[1]); qfglTexCoord2f (((float *) order)[0], ((float *) order)[1]);
order += 2; order += 2;
if (!fb) { if (!fb) {
@ -361,24 +361,24 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
lerp) lerp)
+ (shadedots[verts2->lightnormalindex] * + (shadedots[verts2->lightnormalindex] *
blend)); blend));
glColor4f (shadecolor[0] * light, shadecolor[1] * light, qfglColor4f (shadecolor[0] * light, shadecolor[1] * light,
shadecolor[2] * light, modelalpha); shadecolor[2] * light, modelalpha);
} }
// blend the vertex positions from each frame together // blend the vertex positions from each frame together
glVertex3f ((verts1->v[0] * lerp) + (verts2->v[0] * blend), qfglVertex3f ((verts1->v[0] * lerp) + (verts2->v[0] * blend),
(verts1->v[1] * lerp) + (verts2->v[1] * blend), (verts1->v[1] * lerp) + (verts2->v[1] * blend),
(verts1->v[2] * lerp) + (verts2->v[2] * blend)); (verts1->v[2] * lerp) + (verts2->v[2] * blend));
verts1++; verts1++;
verts2++; verts2++;
} while (--count); } while (--count);
glEnd (); qfglEnd ();
} }
if (modelalpha != 1.0) if (modelalpha != 1.0)
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -412,13 +412,13 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
if (count < 0) { if (count < 0) {
count = -count; count = -count;
glBegin (GL_TRIANGLE_FAN); qfglBegin (GL_TRIANGLE_FAN);
} else } else
glBegin (GL_TRIANGLE_STRIP); qfglBegin (GL_TRIANGLE_STRIP);
do { do {
// texture coordinates come from the draw list // texture coordinates come from the draw list
// (skipped for shadows) glTexCoord2fv ((float *)order); // (skipped for shadows) qfglTexCoord2fv ((float *)order);
order += 2; order += 2;
// normals and vertexes come from the frame list // normals and vertexes come from the frame list
@ -436,12 +436,12 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
point[1] -= shadevector[1] * (point[2] + lheight); point[1] -= shadevector[1] * (point[2] + lheight);
point[2] = height; point[2] = height;
// height -= 0.001; // height -= 0.001;
glVertex3fv (point); qfglVertex3fv (point);
verts++; verts++;
} while (--count); } while (--count);
glEnd (); qfglEnd ();
} }
} }
@ -479,9 +479,9 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
if (count < 0) { if (count < 0) {
count = -count; count = -count;
glBegin (GL_TRIANGLE_FAN); qfglBegin (GL_TRIANGLE_FAN);
} else { } else {
glBegin (GL_TRIANGLE_STRIP); qfglBegin (GL_TRIANGLE_STRIP);
} }
do { do {
@ -501,14 +501,14 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
point2[0] -= shadevector[0] * (point2[2] + lheight); point2[0] -= shadevector[0] * (point2[2] + lheight);
point2[1] -= shadevector[1] * (point2[2] + lheight); point2[1] -= shadevector[1] * (point2[2] + lheight);
glVertex3f ((point1[0] * lerp) + (point2[0] * blend), qfglVertex3f ((point1[0] * lerp) + (point2[0] * blend),
(point1[1] * lerp) + (point2[1] * blend), (point1[1] * lerp) + (point2[1] * blend),
height); height);
verts1++; verts1++;
verts2++; verts2++;
} while (--count); } while (--count);
glEnd (); qfglEnd ();
} }
} }
@ -671,21 +671,21 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
c_alias_polys += paliashdr->mdl.numtris; c_alias_polys += paliashdr->mdl.numtris;
// draw all the triangles // draw all the triangles
glPushMatrix (); qfglPushMatrix ();
R_RotateForEntity (e); R_RotateForEntity (e);
if (strequal (clmodel->name, "progs/eyes.mdl")) { if (strequal (clmodel->name, "progs/eyes.mdl")) {
glTranslatef (paliashdr->mdl.scale_origin[0], qfglTranslatef (paliashdr->mdl.scale_origin[0],
paliashdr->mdl.scale_origin[1], paliashdr->mdl.scale_origin[1],
paliashdr->mdl.scale_origin[2] - (22 + 8)); paliashdr->mdl.scale_origin[2] - (22 + 8));
// double size of eyes, since they are really hard to see in GL // double size of eyes, since they are really hard to see in GL
glScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2, qfglScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2,
paliashdr->mdl.scale[2] * 2); paliashdr->mdl.scale[2] * 2);
} else { } else {
glTranslatef (paliashdr->mdl.scale_origin[0], qfglTranslatef (paliashdr->mdl.scale_origin[0],
paliashdr->mdl.scale_origin[1], paliashdr->mdl.scale_origin[1],
paliashdr->mdl.scale_origin[2]); paliashdr->mdl.scale_origin[2]);
glScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1], qfglScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1],
paliashdr->mdl.scale[2]); paliashdr->mdl.scale[2]);
} }
@ -712,10 +712,10 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
} }
} }
glBindTexture (GL_TEXTURE_2D, texture); qfglBindTexture (GL_TEXTURE_2D, texture);
if (gl_affinemodels->int_val) if (gl_affinemodels->int_val)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
if (gl_lerp_anim->int_val) { if (gl_lerp_anim->int_val) {
R_SetupAliasBlendedFrame (currententity->frame, paliashdr, currententity, false); R_SetupAliasBlendedFrame (currententity->frame, paliashdr, currententity, false);
@ -725,7 +725,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
// This block is GL fullbright support for objects... // This block is GL fullbright support for objects...
if (fb_texture) { if (fb_texture) {
glBindTexture (GL_TEXTURE_2D, fb_texture); qfglBindTexture (GL_TEXTURE_2D, fb_texture);
if (gl_lerp_anim->int_val) { if (gl_lerp_anim->int_val) {
R_SetupAliasBlendedFrame (currententity->frame, paliashdr, R_SetupAliasBlendedFrame (currententity->frame, paliashdr,
currententity, true); currententity, true);
@ -735,9 +735,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
} }
if (gl_affinemodels->int_val) if (gl_affinemodels->int_val)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE); qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
glPopMatrix (); qfglPopMatrix ();
if (r_shadows->int_val) { if (r_shadows->int_val) {
// torches, grenades, and lightning bolts do not have shadows // torches, grenades, and lightning bolts do not have shadows
@ -746,11 +746,11 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
if (strequal (clmodel->name, "progs/grenade.mdl")) if (strequal (clmodel->name, "progs/grenade.mdl"))
return; return;
glPushMatrix (); qfglPushMatrix ();
R_RotateForEntity (e); R_RotateForEntity (e);
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
glColor4f (0, 0, 0, 0.5); qfglColor4f (0, 0, 0, 0.5);
if (gl_lerp_anim->int_val) { if (gl_lerp_anim->int_val) {
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity); GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity);
@ -758,9 +758,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
GL_DrawAliasShadow (paliashdr, lastposenum); GL_DrawAliasShadow (paliashdr, lastposenum);
} }
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glPopMatrix (); qfglPopMatrix ();
} }
} }
@ -860,9 +860,9 @@ R_DrawViewModel (void)
modelalpha = currententity->alpha; modelalpha = currententity->alpha;
// hack the depth range to prevent view model from poking into walls // hack the depth range to prevent view model from poking into walls
glDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); qfglDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
R_DrawAliasModel (currententity, false); R_DrawAliasModel (currententity, false);
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
@ -957,7 +957,7 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
xmin = ymin * aspect; xmin = ymin * aspect;
xmax = ymax * aspect; xmax = ymax * aspect;
glFrustum (xmin, xmax, ymin, ymax, zNear, zFar); qfglFrustum (xmin, xmax, ymin, ymax, zNear, zFar);
} }
@ -969,8 +969,8 @@ R_SetupGL (void)
int x, x2, y2, y, w, h; int x, x2, y2, y, w, h;
// set up viewpoint // set up viewpoint
glMatrixMode (GL_PROJECTION); qfglMatrixMode (GL_PROJECTION);
glLoadIdentity (); qfglLoadIdentity ();
x = r_refdef.vrect.x * glwidth / vid.width; x = r_refdef.vrect.x * glwidth / vid.width;
x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth / vid.width; x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth / vid.width;
y = (vid.height - r_refdef.vrect.y) * glheight / vid.height; y = (vid.height - r_refdef.vrect.y) * glheight / vid.height;
@ -995,41 +995,41 @@ R_SetupGL (void)
w = h = 256; w = h = 256;
} }
glViewport (glx + x, gly + y2, w, h); qfglViewport (glx + x, gly + y2, w, h);
screenaspect = (float) r_refdef.vrect.width / r_refdef.vrect.height; screenaspect = (float) r_refdef.vrect.width / r_refdef.vrect.height;
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096); MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
if (mirror) { if (mirror) {
if (mirror_plane->normal[2]) if (mirror_plane->normal[2])
glScalef (1, -1, 1); qfglScalef (1, -1, 1);
else else
glScalef (-1, 1, 1); qfglScalef (-1, 1, 1);
glCullFace (GL_BACK); qfglCullFace (GL_BACK);
} else } else
glCullFace (GL_FRONT); qfglCullFace (GL_FRONT);
glMatrixMode (GL_MODELVIEW); qfglMatrixMode (GL_MODELVIEW);
glLoadIdentity (); qfglLoadIdentity ();
glRotatef (-90, 1, 0, 0); // put Z going up qfglRotatef (-90, 1, 0, 0); // put Z going up
glRotatef (90, 0, 0, 1); // put Z going up qfglRotatef (90, 0, 0, 1); // put Z going up
glRotatef (-r_refdef.viewangles[2], 1, 0, 0); qfglRotatef (-r_refdef.viewangles[2], 1, 0, 0);
glRotatef (-r_refdef.viewangles[0], 0, 1, 0); qfglRotatef (-r_refdef.viewangles[0], 0, 1, 0);
glRotatef (-r_refdef.viewangles[1], 0, 0, 1); qfglRotatef (-r_refdef.viewangles[1], 0, 0, 1);
glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], qfglTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1],
-r_refdef.vieworg[2]); -r_refdef.vieworg[2]);
glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix); qfglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
// set drawing parms // set drawing parms
glEnable (GL_CULL_FACE); qfglEnable (GL_CULL_FACE);
glDisable (GL_ALPHA_TEST); qfglDisable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.5); qfglAlphaFunc (GL_GREATER, 0.5);
glEnable (GL_DEPTH_TEST); qfglEnable (GL_DEPTH_TEST);
if (gl_dlight_smooth->int_val) if (gl_dlight_smooth->int_val)
glShadeModel (GL_SMOOTH); qfglShadeModel (GL_SMOOTH);
else else
glShadeModel (GL_FLAT); qfglShadeModel (GL_FLAT);
} }
@ -1037,14 +1037,14 @@ static void
R_Clear (void) R_Clear (void)
{ {
if (gl_clear->int_val) if (gl_clear->int_val)
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); qfglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
else else
glClear (GL_DEPTH_BUFFER_BIT); qfglClear (GL_DEPTH_BUFFER_BIT);
gldepthmin = 0; gldepthmin = 0;
gldepthmax = 1; gldepthmax = 1;
glDepthFunc (GL_LEQUAL); qfglDepthFunc (GL_LEQUAL);
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
@ -1112,34 +1112,34 @@ R_Mirror (void)
gldepthmin = 0.5; gldepthmin = 0.5;
gldepthmax = 1; gldepthmax = 1;
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL); qfglDepthFunc (GL_LEQUAL);
R_RenderScene (); R_RenderScene ();
R_DrawWaterSurfaces (); R_DrawWaterSurfaces ();
gldepthmin = 0; gldepthmin = 0;
gldepthmax = 1;//XXX 0.5; gldepthmax = 1;//XXX 0.5;
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL); qfglDepthFunc (GL_LEQUAL);
// blend on top // blend on top
glMatrixMode (GL_PROJECTION); qfglMatrixMode (GL_PROJECTION);
if (mirror_plane->normal[2]) if (mirror_plane->normal[2])
glScalef (1, -1, 1); qfglScalef (1, -1, 1);
else else
glScalef (-1, 1, 1); qfglScalef (-1, 1, 1);
glCullFace (GL_FRONT); qfglCullFace (GL_FRONT);
glMatrixMode (GL_MODELVIEW); qfglMatrixMode (GL_MODELVIEW);
glLoadMatrixf (r_base_world_matrix); qfglLoadMatrixf (r_base_world_matrix);
glColor4f (1, 1, 1, r_mirroralpha->value); qfglColor4f (1, 1, 1, r_mirroralpha->value);
s = r_worldentity.model->textures[mirrortexturenum]->texturechain; s = r_worldentity.model->textures[mirrortexturenum]->texturechain;
for (; s; s = s->texturechain) for (; s; s = s->texturechain)
R_RenderBrushPoly (s); R_RenderBrushPoly (s);
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL; r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
glColor4f (1, 1, 1, 1); qfglColor4f (1, 1, 1, 1);
} }
@ -1157,7 +1157,7 @@ R_RenderView (void)
if (!r_worldentity.model) if (!r_worldentity.model)
Sys_Error ("R_RenderView: NULL worldmodel"); Sys_Error ("R_RenderView: NULL worldmodel");
// glFinish (); // qfglFinish ();
mirror = false; mirror = false;

View file

@ -80,8 +80,8 @@ R_Envmap_f (void)
{ {
byte buffer[256 * 256 * 4]; byte buffer[256 * 256 * 4];
glDrawBuffer (GL_FRONT); qfglDrawBuffer (GL_FRONT);
glReadBuffer (GL_FRONT); qfglReadBuffer (GL_FRONT);
envmap = true; envmap = true;
r_refdef.vrect.x = 0; r_refdef.vrect.x = 0;
@ -94,44 +94,44 @@ R_Envmap_f (void)
r_refdef.viewangles[2] = 0; r_refdef.viewangles[2] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView (); R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env0.rgb", buffer, sizeof (buffer)); COM_WriteFile ("env0.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[1] = 90; r_refdef.viewangles[1] = 90;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView (); R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env1.rgb", buffer, sizeof (buffer)); COM_WriteFile ("env1.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[1] = 180; r_refdef.viewangles[1] = 180;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView (); R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env2.rgb", buffer, sizeof (buffer)); COM_WriteFile ("env2.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[1] = 270; r_refdef.viewangles[1] = 270;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView (); R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env3.rgb", buffer, sizeof (buffer)); COM_WriteFile ("env3.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[0] = -90; r_refdef.viewangles[0] = -90;
r_refdef.viewangles[1] = 0; r_refdef.viewangles[1] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView (); R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env4.rgb", buffer, sizeof (buffer)); COM_WriteFile ("env4.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[0] = 90; r_refdef.viewangles[0] = 90;
r_refdef.viewangles[1] = 0; r_refdef.viewangles[1] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView (); R_RenderView ();
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer); qfglReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env5.rgb", buffer, sizeof (buffer)); COM_WriteFile ("env5.rgb", buffer, sizeof (buffer));
envmap = false; envmap = false;
glDrawBuffer (GL_BACK); qfglDrawBuffer (GL_BACK);
glReadBuffer (GL_BACK); qfglReadBuffer (GL_BACK);
GL_EndRendering (); GL_EndRendering ();
} }
@ -166,14 +166,14 @@ R_Init (void)
texture_extension_number = Skin_Init_Textures (texture_extension_number); texture_extension_number = Skin_Init_Textures (texture_extension_number);
glEnableClientState (GL_COLOR_ARRAY); qfglEnableClientState (GL_COLOR_ARRAY);
glEnableClientState (GL_VERTEX_ARRAY); qfglEnableClientState (GL_VERTEX_ARRAY);
glEnableClientState (GL_TEXTURE_COORD_ARRAY); qfglEnableClientState (GL_TEXTURE_COORD_ARRAY);
// glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray); // qfglInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray);
glTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord); qfglTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord);
glColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color); qfglColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color);
glVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex); qfglVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);
} }
@ -230,7 +230,7 @@ R_TimeRefresh_f (void)
int i; int i;
double start, stop, time; double start, stop, time;
glFinish (); qfglFinish ();
GL_EndRendering (); GL_EndRendering ();
start = Sys_DoubleTime (); start = Sys_DoubleTime ();
@ -238,7 +238,7 @@ R_TimeRefresh_f (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
r_refdef.viewangles[1] = i / 128.0 * 360.0; r_refdef.viewangles[1] = i / 128.0 * 360.0;
R_RenderView (); R_RenderView ();
glFinish (); qfglFinish ();
GL_EndRendering (); GL_EndRendering ();
} }

View file

@ -370,11 +370,11 @@ extern float speedscale; // for top sky and bottom sky
void void
GL_UploadLightmap (int i, int x, int y, int w, int h) GL_UploadLightmap (int i, int x, int y, int w, int h)
{ {
/* glTexSubImage2D (GL_TEXTURE_2D, 0, 0, y, BLOCK_WIDTH, h, gl_lightmap_format, /* qfglTexSubImage2D (GL_TEXTURE_2D, 0, 0, y, BLOCK_WIDTH, h, gl_lightmap_format,
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes); lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes);
*/ */
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH, qfglTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format, BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]); GL_UNSIGNED_BYTE, lightmaps[i]);
} }
@ -398,17 +398,17 @@ R_DrawMultitexturePoly (msurface_t *s)
i = s->lightmaptexturenum; i = s->lightmaptexturenum;
glColor3f (1, 1, 1); qfglColor3f (1, 1, 1);
// Binds world to texture env 0 // Binds world to texture env 0
qglActiveTexture (gl_mtex_enum + 0); qglActiveTexture (gl_mtex_enum + 0);
glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum); qfglBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
// Binds lightmap to texenv 1 // Binds lightmap to texenv 1
qglActiveTexture (gl_mtex_enum + 1); qglActiveTexture (gl_mtex_enum + 1);
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
// check for lightmap modification // check for lightmap modification
if (r_dynamic->int_val) { if (r_dynamic->int_val) {
@ -429,24 +429,24 @@ R_DrawMultitexturePoly (msurface_t *s)
} }
} }
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
v = s->polys->verts[0]; v = s->polys->verts[0];
for (i = 0; i < s->polys->numverts; i++, v += VERTEXSIZE) { for (i = 0; i < s->polys->numverts; i++, v += VERTEXSIZE) {
qglMultiTexCoord2f (gl_mtex_enum + 0, v[3], v[4]); qglMultiTexCoord2f (gl_mtex_enum + 0, v[3], v[4]);
qglMultiTexCoord2f (gl_mtex_enum + 1, v[5], v[6]); qglMultiTexCoord2f (gl_mtex_enum + 1, v[5], v[6]);
glVertex3fv (v); qfglVertex3fv (v);
} }
glEnd (); qfglEnd ();
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
qglActiveTexture (gl_mtex_enum + 0); qglActiveTexture (gl_mtex_enum + 0);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
if (texture->gl_fb_texturenum > 0) { if (texture->gl_fb_texturenum > 0) {
s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum]; s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum];
fullbright_polys[texture->gl_fb_texturenum] = s->polys; fullbright_polys[texture->gl_fb_texturenum] = s->polys;
} }
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
} }
@ -457,17 +457,17 @@ R_BlendLightmaps (void)
glpoly_t *p; glpoly_t *p;
float *v; float *v;
glDepthMask (GL_FALSE); // don't bother writing Z qfglDepthMask (GL_FALSE); // don't bother writing Z
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR); qfglBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
glColor3f (1, 1, 1); qfglColor3f (1, 1, 1);
for (i = 0; i < MAX_LIGHTMAPS; i++) { for (i = 0; i < MAX_LIGHTMAPS; i++) {
p = lightmap_polys[i]; p = lightmap_polys[i];
if (!p) if (!p)
continue; continue;
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
if (lightmap_modified[i]) { if (lightmap_modified[i]) {
GL_UploadLightmap (i, lightmap_rectchange[i].l, GL_UploadLightmap (i, lightmap_rectchange[i].l,
lightmap_rectchange[i].t, lightmap_rectchange[i].t,
@ -476,21 +476,21 @@ R_BlendLightmaps (void)
lightmap_modified[i] = false; lightmap_modified[i] = false;
} }
for (; p; p = p->chain) { for (; p; p = p->chain) {
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
v = p->verts[0]; v = p->verts[0];
for (j = 0; j < p->numverts; j++, v += VERTEXSIZE) { for (j = 0; j < p->numverts; j++, v += VERTEXSIZE) {
glTexCoord2fv (&v[5]); qfglTexCoord2fv (&v[5]);
glVertex3fv (v); qfglVertex3fv (v);
} }
glEnd (); qfglEnd ();
} }
} }
// Return to normal blending --KB // Return to normal blending --KB
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE); // back to normal Z buffering qfglDepthMask (GL_TRUE); // back to normal Z buffering
} }
@ -501,22 +501,22 @@ R_RenderFullbrights (void)
glpoly_t *p; glpoly_t *p;
float *v; float *v;
glBlendFunc (GL_ONE, GL_ONE); qfglBlendFunc (GL_ONE, GL_ONE);
for (i = 1; i < MAX_GLTEXTURES; i++) { for (i = 1; i < MAX_GLTEXTURES; i++) {
if (!fullbright_polys[i]) if (!fullbright_polys[i])
continue; continue;
glBindTexture (GL_TEXTURE_2D, i); qfglBindTexture (GL_TEXTURE_2D, i);
for (p = fullbright_polys[i]; p; p = p->fb_chain) { for (p = fullbright_polys[i]; p; p = p->fb_chain) {
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
for (j = 0, v = p->verts[0]; j < p->numverts; j++, v += VERTEXSIZE) { for (j = 0, v = p->verts[0]; j < p->numverts; j++, v += VERTEXSIZE) {
glTexCoord2fv (&v[3]); qfglTexCoord2fv (&v[3]);
glVertex3fv (v); qfglVertex3fv (v);
} }
glEnd (); qfglEnd ();
} }
} }
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
@ -533,16 +533,16 @@ R_RenderBrushPoly (msurface_t *fa)
c_brush_polys++; c_brush_polys++;
glColor3f (1, 1, 1); qfglColor3f (1, 1, 1);
glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum); qfglBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
v = fa->polys->verts[0]; v = fa->polys->verts[0];
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) { for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
glTexCoord2fv (&v[3]); qfglTexCoord2fv (&v[3]);
glVertex3fv (v); qfglVertex3fv (v);
} }
glEnd (); qfglEnd ();
// add the poly to the proper lightmap chain // add the poly to the proper lightmap chain
@ -585,7 +585,7 @@ R_RenderBrushPoly (msurface_t *fa)
R_BuildLightMap (fa, base, BLOCK_WIDTH * lightmap_bytes); R_BuildLightMap (fa, base, BLOCK_WIDTH * lightmap_bytes);
} }
} }
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
@ -595,13 +595,13 @@ GL_WaterSurface (msurface_t *s)
int i; int i;
i = s->texinfo->texture->gl_texturenum; i = s->texinfo->texture->gl_texturenum;
glBindTexture (GL_TEXTURE_2D, i); qfglBindTexture (GL_TEXTURE_2D, i);
if (r_wateralpha->value < 1.0) { if (r_wateralpha->value < 1.0) {
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
glColor4f (1, 1, 1, r_wateralpha->value); qfglColor4f (1, 1, 1, r_wateralpha->value);
EmitWaterPolys (s); EmitWaterPolys (s);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
} else } else
EmitWaterPolys (s); EmitWaterPolys (s);
} }
@ -617,18 +617,18 @@ R_DrawWaterSurfaces (void)
return; return;
// go back to the world matrix // go back to the world matrix
glLoadMatrixf (r_world_matrix); qfglLoadMatrixf (r_world_matrix);
if (r_wateralpha->value < 1.0) { if (r_wateralpha->value < 1.0) {
glDepthMask (GL_FALSE); qfglDepthMask (GL_FALSE);
glColor4f (1, 1, 1, r_wateralpha->value); qfglColor4f (1, 1, 1, r_wateralpha->value);
} }
i = -1; i = -1;
for (s = waterchain; s; s = s->texturechain) { for (s = waterchain; s; s = s->texturechain) {
if (i != s->texinfo->texture->gl_texturenum) { if (i != s->texinfo->texture->gl_texturenum) {
i = s->texinfo->texture->gl_texturenum; i = s->texinfo->texture->gl_texturenum;
glBindTexture (GL_TEXTURE_2D, i); qfglBindTexture (GL_TEXTURE_2D, i);
} }
EmitWaterPolys (s); EmitWaterPolys (s);
} }
@ -636,8 +636,8 @@ R_DrawWaterSurfaces (void)
waterchain = NULL; waterchain = NULL;
if (r_wateralpha->value < 1.0) { if (r_wateralpha->value < 1.0) {
glDepthMask (GL_TRUE); qfglDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
} }
@ -648,7 +648,7 @@ DrawTextureChains (void)
int i; int i;
msurface_t *s; msurface_t *s;
glDisable (GL_BLEND); qfglDisable (GL_BLEND);
for (i = 0; i < r_worldentity.model->numtextures; i++) { for (i = 0; i < r_worldentity.model->numtextures; i++) {
if (!r_worldentity.model->textures[i]) if (!r_worldentity.model->textures[i])
@ -659,7 +659,7 @@ DrawTextureChains (void)
r_worldentity.model->textures[i]->texturechain = NULL; r_worldentity.model->textures[i]->texturechain = NULL;
} }
glEnable (GL_BLEND); qfglEnable (GL_BLEND);
} }
@ -728,7 +728,7 @@ R_DrawBrushModel (entity_t *e)
} }
} }
glPushMatrix (); qfglPushMatrix ();
e->angles[0] = -e->angles[0]; // stupid quake bug e->angles[0] = -e->angles[0]; // stupid quake bug
R_RotateForEntity (e); R_RotateForEntity (e);
e->angles[0] = -e->angles[0]; // stupid quake bug e->angles[0] = -e->angles[0]; // stupid quake bug
@ -771,7 +771,7 @@ R_DrawBrushModel (entity_t *e)
if (gl_sky_clip->int_val) if (gl_sky_clip->int_val)
R_DrawSkyChain (sky_chain); R_DrawSkyChain (sky_chain);
glPopMatrix (); qfglPopMatrix ();
} }
@ -1198,10 +1198,10 @@ GL_BuildLightmaps (model_t **models, int num_models)
lightmap_rectchange[i].t = BLOCK_HEIGHT; lightmap_rectchange[i].t = BLOCK_HEIGHT;
lightmap_rectchange[i].w = 0; lightmap_rectchange[i].w = 0;
lightmap_rectchange[i].h = 0; lightmap_rectchange[i].h = 0;
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i); qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH, qfglTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format, BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]); GL_UNSIGNED_BYTE, lightmaps[i]);
} }

View file

@ -582,7 +582,7 @@ SCR_ScreenShot (int width, int height)
if (!tex) if (!tex)
return 0; return 0;
glReadPixels (glx, gly, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, qfglReadPixels (glx, gly, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE,
tex->data + vid.width * vid.height); tex->data + vid.width * vid.height);
w = (vid.width < width) ? vid.width : width; w = (vid.width < width) ? vid.width : width;
@ -653,7 +653,7 @@ SCR_ScreenShot_f (void)
return; return;
} }
buffer = malloc (glwidth * glheight * 3); buffer = malloc (glwidth * glheight * 3);
glReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE, qfglReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE,
buffer); buffer);
WriteTGAfile (pcxname, buffer, glwidth, glheight); WriteTGAfile (pcxname, buffer, glwidth, glheight);
free (buffer); free (buffer);
@ -892,33 +892,33 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
} }
// also makes polyblend apply to whole screen // also makes polyblend apply to whole screen
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
if (v_blend[3]) { if (v_blend[3]) {
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
glColor4fv (v_blend); qfglColor4fv (v_blend);
glVertex2f (0, 0); qfglVertex2f (0, 0);
glVertex2f (vid.width, 0); qfglVertex2f (vid.width, 0);
glVertex2f (vid.width, vid.height); qfglVertex2f (vid.width, vid.height);
glVertex2f (0, vid.height); qfglVertex2f (0, vid.height);
glEnd (); qfglEnd ();
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
} }
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
V_UpdatePalette (); V_UpdatePalette ();
if (r_speeds->int_val) { if (r_speeds->int_val) {
// glFinish (); // qfglFinish ();
time2 = Sys_DoubleTime (); time2 = Sys_DoubleTime ();
Con_Printf ("%3i ms %4i wpoly %4i epoly\n", Con_Printf ("%3i ms %4i wpoly %4i epoly\n",
(int) ((time2 - time1) * 1000), c_brush_polys, (int) ((time2 - time1) * 1000), c_brush_polys,
c_alias_polys); c_alias_polys);
} }
glFinish (); qfglFinish ();
GL_EndRendering (); GL_EndRendering ();
} }

View file

@ -137,12 +137,12 @@ build_skin_32 (byte * original, int tinwidth, int tinheight,
} }
} }
glTexImage2D (GL_TEXTURE_2D, 0, samples, qfglTexImage2D (GL_TEXTURE_2D, 0, samples,
scaled_width, scaled_height, 0, GL_RGBA, scaled_width, scaled_height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, pixels); GL_UNSIGNED_BYTE, pixels);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
} }
static void static void
@ -153,7 +153,7 @@ build_skin (int texnum, byte *ptexels, int width, int height,
// because this happens during gameplay, do it fast // because this happens during gameplay, do it fast
// instead of sending it through GL_Upload8() // instead of sending it through GL_Upload8()
glBindTexture (GL_TEXTURE_2D, texnum); qfglBindTexture (GL_TEXTURE_2D, texnum);
// FIXME deek: This 512x256 limit sucks! // FIXME deek: This 512x256 limit sucks!
scaled_width = min (gl_max_size->int_val, 512); scaled_width = min (gl_max_size->int_val, 512);

View file

@ -84,7 +84,7 @@ R_LoadSkys (const char *skyname)
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
byte *targa_rgba; byte *targa_rgba;
glBindTexture (GL_TEXTURE_2D, SKY_TEX + i); qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
snprintf (name, sizeof (name), "env/%s%s.tga", skyname, suf[i]); snprintf (name, sizeof (name), "env/%s%s.tga", skyname, suf[i]);
COM_FOpenFile (name, &f); COM_FOpenFile (name, &f);
if (!f) { if (!f) {
@ -94,13 +94,13 @@ R_LoadSkys (const char *skyname)
} }
targa_rgba = LoadTGA (f); targa_rgba = LoadTGA (f);
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA,
GL_UNSIGNED_BYTE, targa_rgba); GL_UNSIGNED_BYTE, targa_rgba);
free (targa_rgba); free (targa_rgba);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
} }
if (!skyloaded) if (!skyloaded)
Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname); Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
@ -113,8 +113,8 @@ R_SkyBoxPolyVec (vec5_t v)
// avoid interpolation seams // avoid interpolation seams
// s = s * (254.0/256.0) + (1.0/256.0); // s = s * (254.0/256.0) + (1.0/256.0);
// t = t * (254.0/256.0) + (1.0/256.0); // t = t * (254.0/256.0) + (1.0/256.0);
glTexCoord2fv (v); qfglTexCoord2fv (v);
glVertex3f (r_refdef.vieworg[0] + v[2], qfglVertex3f (r_refdef.vieworg[0] + v[2],
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]); r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
} }
@ -172,18 +172,18 @@ R_DrawSkyBox (void)
{ {
int i, j; int i, j;
glDisable (GL_DEPTH_TEST); qfglDisable (GL_DEPTH_TEST);
glDepthRange (gldepthmax, gldepthmax); qfglDepthRange (gldepthmax, gldepthmax);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
glBindTexture (GL_TEXTURE_2D, SKY_TEX + i); qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
glBegin (GL_QUADS); qfglBegin (GL_QUADS);
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
R_SkyBoxPolyVec (skyvec[i][j]); R_SkyBoxPolyVec (skyvec[i][j]);
glEnd (); qfglEnd ();
} }
glEnable (GL_DEPTH_TEST); qfglEnable (GL_DEPTH_TEST);
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
@ -202,9 +202,9 @@ R_DrawSkyLayer (float s)
a2x = bubble_costable[(a + 1) * 2] * domescale[0]; a2x = bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -bubble_sintable[(a + 1) * 2] * domescale[1]; a2y = -bubble_sintable[(a + 1) * 2] * domescale[1];
glBegin (GL_TRIANGLE_STRIP); qfglBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); qfglTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
glVertex3f (r_refdef.vieworg[0], qfglVertex3f (r_refdef.vieworg[0],
r_refdef.vieworg[1], r_refdef.vieworg[2] + domescale[2]); r_refdef.vieworg[1], r_refdef.vieworg[2] + domescale[2]);
for (b = 1; b < 8; b++) { for (b = 1; b < 8; b++) {
x = bubble_costable[b * 2 + 16]; x = bubble_costable[b * 2 + 16];
@ -213,23 +213,23 @@ R_DrawSkyLayer (float s)
v[0] = a1x * x; v[0] = a1x * x;
v[1] = a1y * x; v[1] = a1y * x;
v[2] = y * domescale[2]; v[2] = y * domescale[2];
glTexCoord2f ((v[0] + s) * (1.0 / 128.0), qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0)); (v[1] + s) * (1.0 / 128.0));
glVertex3f (v[0] + r_refdef.vieworg[0], qfglVertex3f (v[0] + r_refdef.vieworg[0],
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]); v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
v[0] = a2x * x; v[0] = a2x * x;
v[1] = a2y * x; v[1] = a2y * x;
v[2] = y * domescale[2]; v[2] = y * domescale[2];
glTexCoord2f ((v[0] + s) * (1.0 / 128.0), qfglTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0)); (v[1] + s) * (1.0 / 128.0));
glVertex3f (v[0] + r_refdef.vieworg[0], qfglVertex3f (v[0] + r_refdef.vieworg[0],
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]); v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
} }
glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0)); qfglTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
glVertex3f (r_refdef.vieworg[0], qfglVertex3f (r_refdef.vieworg[0],
r_refdef.vieworg[1], r_refdef.vieworg[2] - domescale[2]); r_refdef.vieworg[1], r_refdef.vieworg[2] - domescale[2]);
glEnd (); qfglEnd ();
} }
} }
@ -237,24 +237,24 @@ R_DrawSkyLayer (float s)
void void
R_DrawSkyDome (void) R_DrawSkyDome (void)
{ {
glDisable (GL_DEPTH_TEST); qfglDisable (GL_DEPTH_TEST);
glDepthRange (gldepthmax, gldepthmax); qfglDepthRange (gldepthmax, gldepthmax);
glDisable (GL_BLEND); qfglDisable (GL_BLEND);
// base sky // base sky
glBindTexture (GL_TEXTURE_2D, solidskytexture); qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
domescale[0] = 512; domescale[0] = 512;
domescale[1] = 512; domescale[1] = 512;
domescale[2] = 128; domescale[2] = 128;
speedscale = r_realtime * 8; speedscale = r_realtime * 8;
speedscale -= (int) speedscale & ~127; speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
glEnable (GL_BLEND); qfglEnable (GL_BLEND);
// clouds // clouds
if (gl_skymultipass->int_val) { if (gl_skymultipass->int_val) {
glBindTexture (GL_TEXTURE_2D, alphaskytexture); qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
domescale[0] = 512; domescale[0] = 512;
domescale[1] = 512; domescale[1] = 512;
domescale[2] = 128; domescale[2] = 128;
@ -263,8 +263,8 @@ R_DrawSkyDome (void)
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
} }
glEnable (GL_DEPTH_TEST); qfglEnable (GL_DEPTH_TEST);
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} }
@ -317,11 +317,11 @@ R_InitSky (texture_t *mt)
if (!solidskytexture) if (!solidskytexture)
solidskytexture = texture_extension_number++; solidskytexture = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, solidskytexture); qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA, qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans); GL_UNSIGNED_BYTE, trans);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
@ -335,9 +335,9 @@ R_InitSky (texture_t *mt)
if (!alphaskytexture) if (!alphaskytexture)
alphaskytexture = texture_extension_number++; alphaskytexture = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, alphaskytexture); qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA, qfglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans); GL_UNSIGNED_BYTE, trans);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
} }

View file

@ -593,13 +593,13 @@ render_box (struct box_def *box)
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (box->face[i].poly.numverts <= 2) if (box->face[i].poly.numverts <= 2)
continue; continue;
glBindTexture (GL_TEXTURE_2D, box->face[i].tex); qfglBindTexture (GL_TEXTURE_2D, box->face[i].tex);
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
for (j = 0; j < box->face[i].poly.numverts; j++) { for (j = 0; j < box->face[i].poly.numverts; j++) {
glTexCoord2fv (box->face[i].poly.verts[j] + 3); qfglTexCoord2fv (box->face[i].poly.verts[j] + 3);
glVertex3fv (box->face[i].poly.verts[j]); qfglVertex3fv (box->face[i].poly.verts[j]);
} }
glEnd (); qfglEnd ();
} }
} }
@ -668,11 +668,11 @@ R_DrawSkyDomePoly (glpoly_t *poly)
{ {
int i; int i;
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
for (i = 0; i < poly->numverts; i++) { for (i = 0; i < poly->numverts; i++) {
glVertex3fv (poly->verts[i]); qfglVertex3fv (poly->verts[i]);
} }
glEnd (); qfglEnd ();
} }
void void
@ -681,7 +681,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
msurface_t *sc = sky_chain; msurface_t *sc = sky_chain;
if (skyloaded) { if (skyloaded) {
glDepthRange (gldepthmax, gldepthmax); qfglDepthRange (gldepthmax, gldepthmax);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
@ -691,11 +691,11 @@ R_DrawSkyChain (msurface_t *sky_chain)
} }
sc = sc->texturechain; sc = sc->texturechain;
} }
glDepthRange (gldepthmin, gldepthmax); qfglDepthRange (gldepthmin, gldepthmax);
} else { } else {
glDisable (GL_BLEND); qfglDisable (GL_BLEND);
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
glColor3f (0, 0, 0); qfglColor3f (0, 0, 0);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
@ -705,51 +705,51 @@ R_DrawSkyChain (msurface_t *sky_chain)
} }
sc = sc->texturechain; sc = sc->texturechain;
} }
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
glEnable (GL_BLEND); qfglEnable (GL_BLEND);
} }
#if 0 #if 0
// seems to work, but this is the wrong place to do it. // seems to work, but this is the wrong place to do it.
glColor4f (1,1,1,0); qfglColor4f (1,1,1,0);
sc = sky_chain; sc = sky_chain;
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
while (p) { while (p) {
int i; int i;
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
for (i = 0; i < p->numverts; i++) { for (i = 0; i < p->numverts; i++) {
glVertex3fv (p->verts[i]); qfglVertex3fv (p->verts[i]);
} }
glEnd (); qfglEnd ();
p = p->next; p = p->next;
} }
sc = sc->texturechain; sc = sc->texturechain;
} }
#endif #endif
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
#if 0 #if 0
glDisable (GL_TEXTURE_2D); qfglDisable (GL_TEXTURE_2D);
sc = sky_chain; sc = sky_chain;
glColor3f (1, 1, 1); qfglColor3f (1, 1, 1);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
while (p) { while (p) {
int i; int i;
glBegin (GL_LINE_LOOP); qfglBegin (GL_LINE_LOOP);
for (i = 0; i < p->numverts; i++) { for (i = 0; i < p->numverts; i++) {
glVertex3fv (p->verts[i]); qfglVertex3fv (p->verts[i]);
} }
glEnd (); qfglEnd ();
p = p->next; p = p->next;
} }
sc = sc->texturechain; sc = sc->texturechain;
} }
sc = sky_chain; sc = sky_chain;
glColor3f (0, 1, 0); qfglColor3f (0, 1, 0);
glBegin (GL_POINTS); qfglBegin (GL_POINTS);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
@ -763,29 +763,29 @@ R_DrawSkyChain (msurface_t *sky_chain)
} }
VectorScale (c, 1.0 / p->numverts, c); VectorScale (c, 1.0 / p->numverts, c);
VectorAdd (c, r_refdef.vieworg, c); VectorAdd (c, r_refdef.vieworg, c);
glVertex3fv (c); qfglVertex3fv (c);
p = p->next; p = p->next;
} }
sc = sc->texturechain; sc = sc->texturechain;
} }
glEnd (); qfglEnd ();
if (skyloaded) { if (skyloaded) {
int i, j; int i, j;
glColor3f (1, 0, 0); qfglColor3f (1, 0, 0);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
vec3_t v; vec3_t v;
glBegin (GL_LINE_LOOP); qfglBegin (GL_LINE_LOOP);
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
memcpy (v, &skyvec[i][j][2], sizeof (v)); memcpy (v, &skyvec[i][j][2], sizeof (v));
VectorAdd (v, r_refdef.vieworg, v); VectorAdd (v, r_refdef.vieworg, v);
glVertex3fv (v); qfglVertex3fv (v);
} }
glEnd (); qfglEnd ();
} }
} }
glColor3ubv (lighthalf_v); qfglColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
#endif #endif
} }

View file

@ -213,10 +213,10 @@ GL_TextureMode_f (void)
// change all the existing mipmap texture objects // change all the existing mipmap texture objects
for (i = 0, glt = gltextures; i < numgltextures; i++, glt++) { for (i = 0, glt = gltextures; i < numgltextures; i++, glt++) {
if (glt->mipmap) { if (glt->mipmap) {
glBindTexture (GL_TEXTURE_2D, glt->texnum); qfglBindTexture (GL_TEXTURE_2D, glt->texnum);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_min); gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max); gl_filter_max);
} }
} }
@ -395,7 +395,7 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
scaled_height); scaled_height);
} }
glTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0, qfglTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, scaled); GL_RGBA, GL_UNSIGNED_BYTE, scaled);
if (mipmap) { if (mipmap) {
@ -408,20 +408,20 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
scaled_width = max (scaled_width, 1); scaled_width = max (scaled_width, 1);
scaled_height = max (scaled_height, 1); scaled_height = max (scaled_height, 1);
miplevel++; miplevel++;
glTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width, qfglTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width,
scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled); scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
} }
} }
if (mipmap) { if (mipmap) {
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
} else { } else {
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
if (gl_picmip->int_val) if (gl_picmip->int_val)
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
else else
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
} }
free (scaled); free (scaled);
@ -463,7 +463,7 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
GL_Resample8BitTexture (data, width, height, scaled, scaled_width, GL_Resample8BitTexture (data, width, height, scaled, scaled_width,
scaled_height); scaled_height);
} }
glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width, qfglTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width,
scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled); scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled);
if (mipmap) { if (mipmap) {
@ -477,21 +477,21 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
scaled_width = max (scaled_width, 1); scaled_width = max (scaled_width, 1);
scaled_height = max (scaled_height, 1); scaled_height = max (scaled_height, 1);
miplevel++; miplevel++;
glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT, qfglTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT,
scaled_width, scaled_height, 0, GL_COLOR_INDEX, scaled_width, scaled_height, 0, GL_COLOR_INDEX,
GL_UNSIGNED_BYTE, scaled); GL_UNSIGNED_BYTE, scaled);
} }
} }
if (mipmap) { if (mipmap) {
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
} else { } else {
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
if (gl_picmip->int_val) if (gl_picmip->int_val)
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
else else
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
} }
free (scaled); free (scaled);
@ -588,7 +588,7 @@ SetupTexture:
glt->bytesperpixel = bytesperpixel; glt->bytesperpixel = bytesperpixel;
glt->mipmap = mipmap; glt->mipmap = mipmap;
glBindTexture (GL_TEXTURE_2D, glt->texnum); qfglBindTexture (GL_TEXTURE_2D, glt->texnum);
switch (glt->bytesperpixel) { switch (glt->bytesperpixel) {
case 1: case 1:

View file

@ -208,7 +208,7 @@ EmitWaterPolys (msurface_t *fa)
vec3_t nv; vec3_t nv;
for (p = fa->polys; p; p = p->next) { for (p = fa->polys; p; p = p->next) {
glBegin (GL_POLYGON); qfglBegin (GL_POLYGON);
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) { for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) {
os = v[3]; os = v[3];
ot = v[4]; ot = v[4];
@ -219,7 +219,7 @@ EmitWaterPolys (msurface_t *fa)
t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255]; t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255];
t *= (1.0 / 64); t *= (1.0 / 64);
glTexCoord2f (s, t); qfglTexCoord2f (s, t);
VectorCopy (v, nv); VectorCopy (v, nv);
nv[2] += r_waterripple->value nv[2] += r_waterripple->value
@ -227,8 +227,8 @@ EmitWaterPolys (msurface_t *fa)
* turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255] * turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255]
* (1.0 / 64.0); * (1.0 / 64.0);
glVertex3fv (nv); qfglVertex3fv (nv);
} }
glEnd (); qfglEnd ();
} }
} }

View file

@ -169,7 +169,8 @@ TragicDeath (int sig)
{ {
printf ("Received signal %d, exiting...\n", sig); printf ("Received signal %d, exiting...\n", sig);
Sys_Quit (); Sys_Quit ();
exit (sig); abort(); // Hopefully not an infinite loop.
// exit (sig);
// XCloseDisplay(x_disp); // XCloseDisplay(x_disp);
// VID_Shutdown(); // VID_Shutdown();
// Sys_Error("This death brought to you by the number %d\n", signal_num); // Sys_Error("This death brought to you by the number %d\n", signal_num);

View file

@ -98,7 +98,7 @@ QFGL_ExtensionPresent (const char *name)
static const GLubyte *gl_extensions = NULL; static const GLubyte *gl_extensions = NULL;
if (!gl_extensions) { // get and save GL extension list if (!gl_extensions) { // get and save GL extension list
gl_extensions = glGetString (GL_EXTENSIONS); gl_extensions = qfglGetString (GL_EXTENSIONS);
} }
return QFGL_ParseExtensionList (gl_extensions, name); return QFGL_ParseExtensionList (gl_extensions, name);

View file

@ -135,7 +135,7 @@ GL_Init (void)
Con_Printf ("4x4.\n"); Con_Printf ("4x4.\n");
} }
} else { } else {
glDisable (GL_DITHER); qfglDisable (GL_DITHER);
Con_Printf ("disabled.\n"); Con_Printf ("disabled.\n");
} }
} }
@ -143,7 +143,7 @@ GL_Init (void)
void void
GL_EndRendering (void) GL_EndRendering (void)
{ {
glFlush (); qfglFlush ();
fxMesaSwapBuffers (); fxMesaSwapBuffers ();
Sbar_Changed (); Sbar_Changed ();
} }

View file

@ -121,7 +121,7 @@ CheckMultiTextureExtensions (void)
int max_texture_units = 0; int max_texture_units = 0;
glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units); qfglGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units);
if (max_texture_units >= 2) { if (max_texture_units >= 2) {
Con_Printf ("enabled, %d TMUs.\n", max_texture_units); Con_Printf ("enabled, %d TMUs.\n", max_texture_units);
qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB"); qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB");
@ -231,36 +231,36 @@ GL_Init_Common (void)
return; return;
} }
gl_vendor = glGetString (GL_VENDOR); gl_vendor = qfglGetString (GL_VENDOR);
Con_Printf ("GL_VENDOR: %s\n", gl_vendor); Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
gl_renderer = glGetString (GL_RENDERER); gl_renderer = qfglGetString (GL_RENDERER);
Con_Printf ("GL_RENDERER: %s\n", gl_renderer); Con_Printf ("GL_RENDERER: %s\n", gl_renderer);
gl_version = glGetString (GL_VERSION); gl_version = qfglGetString (GL_VERSION);
Con_Printf ("GL_VERSION: %s\n", gl_version); Con_Printf ("GL_VERSION: %s\n", gl_version);
gl_extensions = glGetString (GL_EXTENSIONS); gl_extensions = qfglGetString (GL_EXTENSIONS);
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions); Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
glClearColor (0, 0, 0, 0); qfglClearColor (0, 0, 0, 0);
glCullFace (GL_FRONT); qfglCullFace (GL_FRONT);
glEnable (GL_TEXTURE_2D); qfglEnable (GL_TEXTURE_2D);
glEnable (GL_ALPHA_TEST); qfglEnable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.666); qfglAlphaFunc (GL_GREATER, 0.666);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); qfglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
glShadeModel (GL_FLAT); qfglShadeModel (GL_FLAT);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glEnable (GL_BLEND); qfglEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
CheckMultiTextureExtensions (); CheckMultiTextureExtensions ();
} }
@ -315,7 +315,7 @@ Tdfx_Init8bitPalette (void)
table[i][3] = 255; table[i][3] = 255;
oldpal++; oldpal++;
} }
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); qfglEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
qgl3DfxSetPaletteEXT ((GLuint *) table); qgl3DfxSetPaletteEXT ((GLuint *) table);
is8bit = true; is8bit = true;
} else { } else {
@ -351,7 +351,7 @@ Shared_Init8bitPalette (void)
Con_Printf ("GL_EXT_shared_texture_palette\n"); Con_Printf ("GL_EXT_shared_texture_palette\n");
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); qfglEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx; oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx;
newPalette = thePalette; newPalette = thePalette;
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {

View file

@ -146,7 +146,7 @@ GL_Init (void)
void void
GL_EndRendering (void) GL_EndRendering (void)
{ {
glFlush (); qfglFlush ();
glXSwapBuffers (x_disp, x_win); glXSwapBuffers (x_disp, x_win);
Sbar_Changed (); Sbar_Changed ();
} }

View file

@ -525,7 +525,7 @@ VID_Shutdown (void)
// LordHavoc: free textures before closing (may help NVIDIA) // LordHavoc: free textures before closing (may help NVIDIA)
for (i = 0; i < 8192; i++) for (i = 0; i < 8192; i++)
temp[i] = i + 1; temp[i] = i + 1;
glDeleteTextures (8192, temp); qfglDeleteTextures (8192, temp);
if (hRC) if (hRC)
wglDeleteContext (hRC); wglDeleteContext (hRC);