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/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"
#undef QFGL_NEED

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -122,22 +122,22 @@ R_LineGraph (int x, int y, int *h_vals, int count)
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);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x, y);
glTexCoord2f (1, 0);
glVertex2f (x + graph_width[graph_index], y);
glTexCoord2f (1, 1);
glVertex2f (x + graph_width[graph_index], y - s);
glTexCoord2f (0, 1);
glVertex2f (x, y - s);
glEnd ();
qfglBegin (GL_QUADS);
qfglTexCoord2f (0, 0);
qfglVertex2f (x, y);
qfglTexCoord2f (1, 0);
qfglVertex2f (x + graph_width[graph_index], y);
qfglTexCoord2f (1, 1);
qfglVertex2f (x + graph_width[graph_index], y - s);
qfglTexCoord2f (0, 1);
qfglVertex2f (x, y - s);
qfglEnd ();
glColor3ubv (lighthalf_v);
qfglColor3ubv (lighthalf_v);
graph_index = (graph_index + 1) % NUM_GRAPH_TEXTURES;
}

View file

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

View file

@ -117,12 +117,12 @@ glrmain_init (void)
void
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);
glRotatef (-e->angles[0], 0, 1, 0);
qfglRotatef (e->angles[1], 0, 0, 1);
qfglRotatef (-e->angles[0], 0, 1, 0);
// 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;
}
glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
qfglBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
glEnable (GL_ALPHA_TEST);
glBegin (GL_QUADS);
qfglEnable (GL_ALPHA_TEST);
qfglBegin (GL_QUADS);
glTexCoord2f (0, 1);
qfglTexCoord2f (0, 1);
VectorMA (e->origin, frame->down, up, 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 (point, frame->left, right, point);
glVertex3fv (point);
qfglVertex3fv (point);
glTexCoord2f (1, 0);
qfglTexCoord2f (1, 0);
VectorMA (e->origin, frame->up, up, 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 (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);
if (modelalpha != 1.0)
glDepthMask (GL_FALSE);
qfglDepthMask (GL_FALSE);
if (fb) {
glColor4f (1, 1, 1, modelalpha);
qfglColor4f (1, 1, 1, modelalpha);
}
while ((count = *order++)) {
// get the vertex count and primitive type
if (count < 0) {
count = -count;
glBegin (GL_TRIANGLE_FAN);
qfglBegin (GL_TRIANGLE_FAN);
} else {
glBegin (GL_TRIANGLE_STRIP);
qfglBegin (GL_TRIANGLE_STRIP);
}
do {
// texture coordinates come from the draw list
glTexCoord2f (((float *) order)[0], ((float *) order)[1]);
qfglTexCoord2f (((float *) order)[0], ((float *) order)[1]);
order += 2;
if (!fb) {
@ -288,21 +288,21 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
l = shadedots[verts->lightnormalindex] * shadelight;
// LordHavoc: cleanup after Endy
glColor4f (shadecolor[0] * l, shadecolor[1] * l,
qfglColor4f (shadecolor[0] * l, shadecolor[1] * l,
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++;
} while (--count);
glEnd ();
qfglEnd ();
}
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);
if (modelalpha != 1.0)
glDepthMask (GL_FALSE);
qfglDepthMask (GL_FALSE);
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;
@ -344,14 +344,14 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
if (count < 0) {
count = -count;
glBegin (GL_TRIANGLE_FAN);
qfglBegin (GL_TRIANGLE_FAN);
} else {
glBegin (GL_TRIANGLE_STRIP);
qfglBegin (GL_TRIANGLE_STRIP);
}
do {
// texture coordinates come from the draw list
glTexCoord2f (((float *) order)[0], ((float *) order)[1]);
qfglTexCoord2f (((float *) order)[0], ((float *) order)[1]);
order += 2;
if (!fb) {
@ -361,24 +361,24 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
lerp)
+ (shadedots[verts2->lightnormalindex] *
blend));
glColor4f (shadecolor[0] * light, shadecolor[1] * light,
qfglColor4f (shadecolor[0] * light, shadecolor[1] * light,
shadecolor[2] * light, modelalpha);
}
// 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[2] * lerp) + (verts2->v[2] * blend));
verts1++;
verts2++;
} while (--count);
glEnd ();
qfglEnd ();
}
if (modelalpha != 1.0)
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
qfglDepthMask (GL_TRUE);
qfglColor3ubv (lighthalf_v);
}
@ -412,13 +412,13 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
if (count < 0) {
count = -count;
glBegin (GL_TRIANGLE_FAN);
qfglBegin (GL_TRIANGLE_FAN);
} else
glBegin (GL_TRIANGLE_STRIP);
qfglBegin (GL_TRIANGLE_STRIP);
do {
// texture coordinates come from the draw list
// (skipped for shadows) glTexCoord2fv ((float *)order);
// (skipped for shadows) qfglTexCoord2fv ((float *)order);
order += 2;
// 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[2] = height;
// height -= 0.001;
glVertex3fv (point);
qfglVertex3fv (point);
verts++;
} while (--count);
glEnd ();
qfglEnd ();
}
}
@ -479,9 +479,9 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
if (count < 0) {
count = -count;
glBegin (GL_TRIANGLE_FAN);
qfglBegin (GL_TRIANGLE_FAN);
} else {
glBegin (GL_TRIANGLE_STRIP);
qfglBegin (GL_TRIANGLE_STRIP);
}
do {
@ -501,14 +501,14 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
point2[0] -= shadevector[0] * (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),
height);
verts1++;
verts2++;
} while (--count);
glEnd ();
qfglEnd ();
}
}
@ -671,21 +671,21 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
c_alias_polys += paliashdr->mdl.numtris;
// draw all the triangles
glPushMatrix ();
qfglPushMatrix ();
R_RotateForEntity (e);
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[2] - (22 + 8));
// 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);
} else {
glTranslatef (paliashdr->mdl.scale_origin[0],
qfglTranslatef (paliashdr->mdl.scale_origin[0],
paliashdr->mdl.scale_origin[1],
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]);
}
@ -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)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
if (gl_lerp_anim->int_val) {
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...
if (fb_texture) {
glBindTexture (GL_TEXTURE_2D, fb_texture);
qfglBindTexture (GL_TEXTURE_2D, fb_texture);
if (gl_lerp_anim->int_val) {
R_SetupAliasBlendedFrame (currententity->frame, paliashdr,
currententity, true);
@ -735,9 +735,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
}
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) {
// 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"))
return;
glPushMatrix ();
qfglPushMatrix ();
R_RotateForEntity (e);
glDisable (GL_TEXTURE_2D);
glColor4f (0, 0, 0, 0.5);
qfglDisable (GL_TEXTURE_2D);
qfglColor4f (0, 0, 0, 0.5);
if (gl_lerp_anim->int_val) {
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity);
@ -758,9 +758,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
GL_DrawAliasShadow (paliashdr, lastposenum);
}
glEnable (GL_TEXTURE_2D);
glColor3ubv (lighthalf_v);
glPopMatrix ();
qfglEnable (GL_TEXTURE_2D);
qfglColor3ubv (lighthalf_v);
qfglPopMatrix ();
}
}
@ -860,9 +860,9 @@ R_DrawViewModel (void)
modelalpha = currententity->alpha;
// 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);
glDepthRange (gldepthmin, gldepthmax);
qfglDepthRange (gldepthmin, gldepthmax);
}
@ -957,7 +957,7 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
xmin = ymin * 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;
// set up viewpoint
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
qfglMatrixMode (GL_PROJECTION);
qfglLoadIdentity ();
x = r_refdef.vrect.x * 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;
@ -995,41 +995,41 @@ R_SetupGL (void)
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;
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
if (mirror) {
if (mirror_plane->normal[2])
glScalef (1, -1, 1);
qfglScalef (1, -1, 1);
else
glScalef (-1, 1, 1);
glCullFace (GL_BACK);
qfglScalef (-1, 1, 1);
qfglCullFace (GL_BACK);
} else
glCullFace (GL_FRONT);
qfglCullFace (GL_FRONT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
qfglMatrixMode (GL_MODELVIEW);
qfglLoadIdentity ();
glRotatef (-90, 1, 0, 0); // put Z going up
glRotatef (90, 0, 0, 1); // put Z going up
glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1],
qfglRotatef (-90, 1, 0, 0); // put Z going up
qfglRotatef (90, 0, 0, 1); // put Z going up
qfglRotatef (-r_refdef.viewangles[2], 1, 0, 0);
qfglRotatef (-r_refdef.viewangles[0], 0, 1, 0);
qfglRotatef (-r_refdef.viewangles[1], 0, 0, 1);
qfglTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1],
-r_refdef.vieworg[2]);
glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
qfglGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
// set drawing parms
glEnable (GL_CULL_FACE);
glDisable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.5);
glEnable (GL_DEPTH_TEST);
qfglEnable (GL_CULL_FACE);
qfglDisable (GL_ALPHA_TEST);
qfglAlphaFunc (GL_GREATER, 0.5);
qfglEnable (GL_DEPTH_TEST);
if (gl_dlight_smooth->int_val)
glShadeModel (GL_SMOOTH);
qfglShadeModel (GL_SMOOTH);
else
glShadeModel (GL_FLAT);
qfglShadeModel (GL_FLAT);
}
@ -1037,14 +1037,14 @@ static void
R_Clear (void)
{
if (gl_clear->int_val)
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
qfglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
else
glClear (GL_DEPTH_BUFFER_BIT);
qfglClear (GL_DEPTH_BUFFER_BIT);
gldepthmin = 0;
gldepthmax = 1;
glDepthFunc (GL_LEQUAL);
qfglDepthFunc (GL_LEQUAL);
glDepthRange (gldepthmin, gldepthmax);
qfglDepthRange (gldepthmin, gldepthmax);
}
@ -1112,34 +1112,34 @@ R_Mirror (void)
gldepthmin = 0.5;
gldepthmax = 1;
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
qfglDepthRange (gldepthmin, gldepthmax);
qfglDepthFunc (GL_LEQUAL);
R_RenderScene ();
R_DrawWaterSurfaces ();
gldepthmin = 0;
gldepthmax = 1;//XXX 0.5;
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
qfglDepthRange (gldepthmin, gldepthmax);
qfglDepthFunc (GL_LEQUAL);
// blend on top
glMatrixMode (GL_PROJECTION);
qfglMatrixMode (GL_PROJECTION);
if (mirror_plane->normal[2])
glScalef (1, -1, 1);
qfglScalef (1, -1, 1);
else
glScalef (-1, 1, 1);
glCullFace (GL_FRONT);
glMatrixMode (GL_MODELVIEW);
qfglScalef (-1, 1, 1);
qfglCullFace (GL_FRONT);
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;
for (; s; s = s->texturechain)
R_RenderBrushPoly (s);
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)
Sys_Error ("R_RenderView: NULL worldmodel");
// glFinish ();
// qfglFinish ();
mirror = false;

View file

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

View file

@ -370,11 +370,11 @@ extern float speedscale; // for top sky and bottom sky
void
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,
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,
GL_UNSIGNED_BYTE, lightmaps[i]);
}
@ -398,17 +398,17 @@ R_DrawMultitexturePoly (msurface_t *s)
i = s->lightmaptexturenum;
glColor3f (1, 1, 1);
qfglColor3f (1, 1, 1);
// Binds world to texture env 0
qglActiveTexture (gl_mtex_enum + 0);
glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable (GL_TEXTURE_2D);
qfglBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
qfglEnable (GL_TEXTURE_2D);
// Binds lightmap to texenv 1
qglActiveTexture (gl_mtex_enum + 1);
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable (GL_TEXTURE_2D);
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qfglEnable (GL_TEXTURE_2D);
// check for lightmap modification
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];
for (i = 0; i < s->polys->numverts; i++, v += VERTEXSIZE) {
qglMultiTexCoord2f (gl_mtex_enum + 0, v[3], v[4]);
qglMultiTexCoord2f (gl_mtex_enum + 1, v[5], v[6]);
glVertex3fv (v);
qfglVertex3fv (v);
}
glEnd ();
glDisable (GL_TEXTURE_2D);
qfglEnd ();
qfglDisable (GL_TEXTURE_2D);
qglActiveTexture (gl_mtex_enum + 0);
glEnable (GL_TEXTURE_2D);
qfglEnable (GL_TEXTURE_2D);
if (texture->gl_fb_texturenum > 0) {
s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum];
fullbright_polys[texture->gl_fb_texturenum] = s->polys;
}
glColor3ubv (lighthalf_v);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
qfglColor3ubv (lighthalf_v);
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
@ -457,17 +457,17 @@ R_BlendLightmaps (void)
glpoly_t *p;
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++) {
p = lightmap_polys[i];
if (!p)
continue;
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
if (lightmap_modified[i]) {
GL_UploadLightmap (i, lightmap_rectchange[i].l,
lightmap_rectchange[i].t,
@ -476,21 +476,21 @@ R_BlendLightmaps (void)
lightmap_modified[i] = false;
}
for (; p; p = p->chain) {
glBegin (GL_POLYGON);
qfglBegin (GL_POLYGON);
v = p->verts[0];
for (j = 0; j < p->numverts; j++, v += VERTEXSIZE) {
glTexCoord2fv (&v[5]);
glVertex3fv (v);
qfglTexCoord2fv (&v[5]);
qfglVertex3fv (v);
}
glEnd ();
qfglEnd ();
}
}
// Return to normal blending --KB
glColor3ubv (lighthalf_v);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
qfglColor3ubv (lighthalf_v);
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;
float *v;
glBlendFunc (GL_ONE, GL_ONE);
qfglBlendFunc (GL_ONE, GL_ONE);
for (i = 1; i < MAX_GLTEXTURES; i++) {
if (!fullbright_polys[i])
continue;
glBindTexture (GL_TEXTURE_2D, i);
qfglBindTexture (GL_TEXTURE_2D, i);
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) {
glTexCoord2fv (&v[3]);
glVertex3fv (v);
qfglTexCoord2fv (&v[3]);
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++;
glColor3f (1, 1, 1);
glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
qfglColor3f (1, 1, 1);
qfglBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
glBegin (GL_POLYGON);
qfglBegin (GL_POLYGON);
v = fa->polys->verts[0];
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
glTexCoord2fv (&v[3]);
glVertex3fv (v);
qfglTexCoord2fv (&v[3]);
qfglVertex3fv (v);
}
glEnd ();
qfglEnd ();
// 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);
}
}
glColor3ubv (lighthalf_v);
qfglColor3ubv (lighthalf_v);
}
@ -595,13 +595,13 @@ GL_WaterSurface (msurface_t *s)
int i;
i = s->texinfo->texture->gl_texturenum;
glBindTexture (GL_TEXTURE_2D, i);
qfglBindTexture (GL_TEXTURE_2D, i);
if (r_wateralpha->value < 1.0) {
glDepthMask (GL_FALSE);
glColor4f (1, 1, 1, r_wateralpha->value);
qfglDepthMask (GL_FALSE);
qfglColor4f (1, 1, 1, r_wateralpha->value);
EmitWaterPolys (s);
glColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE);
qfglColor3ubv (lighthalf_v);
qfglDepthMask (GL_TRUE);
} else
EmitWaterPolys (s);
}
@ -617,18 +617,18 @@ R_DrawWaterSurfaces (void)
return;
// go back to the world matrix
glLoadMatrixf (r_world_matrix);
qfglLoadMatrixf (r_world_matrix);
if (r_wateralpha->value < 1.0) {
glDepthMask (GL_FALSE);
glColor4f (1, 1, 1, r_wateralpha->value);
qfglDepthMask (GL_FALSE);
qfglColor4f (1, 1, 1, r_wateralpha->value);
}
i = -1;
for (s = waterchain; s; s = s->texturechain) {
if (i != s->texinfo->texture->gl_texturenum) {
i = s->texinfo->texture->gl_texturenum;
glBindTexture (GL_TEXTURE_2D, i);
qfglBindTexture (GL_TEXTURE_2D, i);
}
EmitWaterPolys (s);
}
@ -636,8 +636,8 @@ R_DrawWaterSurfaces (void)
waterchain = NULL;
if (r_wateralpha->value < 1.0) {
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
qfglDepthMask (GL_TRUE);
qfglColor3ubv (lighthalf_v);
}
}
@ -648,7 +648,7 @@ DrawTextureChains (void)
int i;
msurface_t *s;
glDisable (GL_BLEND);
qfglDisable (GL_BLEND);
for (i = 0; i < r_worldentity.model->numtextures; i++) {
if (!r_worldentity.model->textures[i])
@ -659,7 +659,7 @@ DrawTextureChains (void)
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
R_RotateForEntity (e);
e->angles[0] = -e->angles[0]; // stupid quake bug
@ -771,7 +771,7 @@ R_DrawBrushModel (entity_t *e)
if (gl_sky_clip->int_val)
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].w = 0;
lightmap_rectchange[i].h = 0;
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qfglTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]);
}

View file

@ -582,7 +582,7 @@ SCR_ScreenShot (int width, int height)
if (!tex)
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);
w = (vid.width < width) ? vid.width : width;
@ -653,7 +653,7 @@ SCR_ScreenShot_f (void)
return;
}
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);
WriteTGAfile (pcxname, buffer, glwidth, glheight);
free (buffer);
@ -892,33 +892,33 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
}
// also makes polyblend apply to whole screen
glDisable (GL_TEXTURE_2D);
qfglDisable (GL_TEXTURE_2D);
if (v_blend[3]) {
glBegin (GL_QUADS);
qfglBegin (GL_QUADS);
glColor4fv (v_blend);
glVertex2f (0, 0);
glVertex2f (vid.width, 0);
glVertex2f (vid.width, vid.height);
glVertex2f (0, vid.height);
qfglColor4fv (v_blend);
qfglVertex2f (0, 0);
qfglVertex2f (vid.width, 0);
qfglVertex2f (vid.width, vid.height);
qfglVertex2f (0, vid.height);
glEnd ();
glColor3ubv (lighthalf_v);
qfglEnd ();
qfglColor3ubv (lighthalf_v);
}
glEnable (GL_TEXTURE_2D);
qfglEnable (GL_TEXTURE_2D);
V_UpdatePalette ();
if (r_speeds->int_val) {
// glFinish ();
// qfglFinish ();
time2 = Sys_DoubleTime ();
Con_Printf ("%3i ms %4i wpoly %4i epoly\n",
(int) ((time2 - time1) * 1000), c_brush_polys,
c_alias_polys);
}
glFinish ();
qfglFinish ();
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,
GL_UNSIGNED_BYTE, pixels);
glTexParameterf (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_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
static void
@ -153,7 +153,7 @@ build_skin (int texnum, byte *ptexels, int width, int height,
// because this happens during gameplay, do it fast
// instead of sending it through GL_Upload8()
glBindTexture (GL_TEXTURE_2D, texnum);
qfglBindTexture (GL_TEXTURE_2D, texnum);
// FIXME deek: This 512x256 limit sucks!
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++) {
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]);
COM_FOpenFile (name, &f);
if (!f) {
@ -94,13 +94,13 @@ R_LoadSkys (const char *skyname)
}
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);
free (targa_rgba);
glTexParameterf (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_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
if (!skyloaded)
Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
@ -113,8 +113,8 @@ R_SkyBoxPolyVec (vec5_t v)
// avoid interpolation seams
// s = s * (254.0/256.0) + (1.0/256.0);
// t = t * (254.0/256.0) + (1.0/256.0);
glTexCoord2fv (v);
glVertex3f (r_refdef.vieworg[0] + v[2],
qfglTexCoord2fv (v);
qfglVertex3f (r_refdef.vieworg[0] + v[2],
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
}
@ -172,18 +172,18 @@ R_DrawSkyBox (void)
{
int i, j;
glDisable (GL_DEPTH_TEST);
glDepthRange (gldepthmax, gldepthmax);
qfglDisable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmax, gldepthmax);
for (i = 0; i < 6; i++) {
glBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
glBegin (GL_QUADS);
qfglBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
qfglBegin (GL_QUADS);
for (j = 0; j < 4; j++)
R_SkyBoxPolyVec (skyvec[i][j]);
glEnd ();
qfglEnd ();
}
glEnable (GL_DEPTH_TEST);
glDepthRange (gldepthmin, gldepthmax);
qfglEnable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmin, gldepthmax);
}
@ -202,9 +202,9 @@ R_DrawSkyLayer (float s)
a2x = bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -bubble_sintable[(a + 1) * 2] * domescale[1];
glBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
glVertex3f (r_refdef.vieworg[0],
qfglBegin (GL_TRIANGLE_STRIP);
qfglTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
qfglVertex3f (r_refdef.vieworg[0],
r_refdef.vieworg[1], r_refdef.vieworg[2] + domescale[2]);
for (b = 1; b < 8; b++) {
x = bubble_costable[b * 2 + 16];
@ -213,23 +213,23 @@ R_DrawSkyLayer (float s)
v[0] = a1x * x;
v[1] = a1y * x;
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));
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[0] = a2x * x;
v[1] = a2y * x;
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));
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]);
}
glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
glVertex3f (r_refdef.vieworg[0],
qfglTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
qfglVertex3f (r_refdef.vieworg[0],
r_refdef.vieworg[1], r_refdef.vieworg[2] - domescale[2]);
glEnd ();
qfglEnd ();
}
}
@ -237,24 +237,24 @@ R_DrawSkyLayer (float s)
void
R_DrawSkyDome (void)
{
glDisable (GL_DEPTH_TEST);
glDepthRange (gldepthmax, gldepthmax);
qfglDisable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmax, gldepthmax);
glDisable (GL_BLEND);
qfglDisable (GL_BLEND);
// base sky
glBindTexture (GL_TEXTURE_2D, solidskytexture);
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
domescale[0] = 512;
domescale[1] = 512;
domescale[2] = 128;
speedscale = r_realtime * 8;
speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale);
glEnable (GL_BLEND);
qfglEnable (GL_BLEND);
// clouds
if (gl_skymultipass->int_val) {
glBindTexture (GL_TEXTURE_2D, alphaskytexture);
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
domescale[0] = 512;
domescale[1] = 512;
domescale[2] = 128;
@ -263,8 +263,8 @@ R_DrawSkyDome (void)
R_DrawSkyLayer (speedscale);
}
glEnable (GL_DEPTH_TEST);
glDepthRange (gldepthmin, gldepthmax);
qfglEnable (GL_DEPTH_TEST);
qfglDepthRange (gldepthmin, gldepthmax);
}
@ -317,11 +317,11 @@ R_InitSky (texture_t *mt)
if (!solidskytexture)
solidskytexture = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, solidskytexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA,
qfglBindTexture (GL_TEXTURE_2D, solidskytexture);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
glTexParameterf (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_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (i = 0; i < 128; i++)
@ -335,9 +335,9 @@ R_InitSky (texture_t *mt)
if (!alphaskytexture)
alphaskytexture = texture_extension_number++;
glBindTexture (GL_TEXTURE_2D, alphaskytexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA,
qfglBindTexture (GL_TEXTURE_2D, alphaskytexture);
qfglTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
glTexParameterf (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_MIN_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++) {
if (box->face[i].poly.numverts <= 2)
continue;
glBindTexture (GL_TEXTURE_2D, box->face[i].tex);
glBegin (GL_POLYGON);
qfglBindTexture (GL_TEXTURE_2D, box->face[i].tex);
qfglBegin (GL_POLYGON);
for (j = 0; j < box->face[i].poly.numverts; j++) {
glTexCoord2fv (box->face[i].poly.verts[j] + 3);
glVertex3fv (box->face[i].poly.verts[j]);
qfglTexCoord2fv (box->face[i].poly.verts[j] + 3);
qfglVertex3fv (box->face[i].poly.verts[j]);
}
glEnd ();
qfglEnd ();
}
}
@ -668,11 +668,11 @@ R_DrawSkyDomePoly (glpoly_t *poly)
{
int i;
glBegin (GL_POLYGON);
qfglBegin (GL_POLYGON);
for (i = 0; i < poly->numverts; i++) {
glVertex3fv (poly->verts[i]);
qfglVertex3fv (poly->verts[i]);
}
glEnd ();
qfglEnd ();
}
void
@ -681,7 +681,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
msurface_t *sc = sky_chain;
if (skyloaded) {
glDepthRange (gldepthmax, gldepthmax);
qfglDepthRange (gldepthmax, gldepthmax);
while (sc) {
glpoly_t *p = sc->polys;
@ -691,11 +691,11 @@ R_DrawSkyChain (msurface_t *sky_chain)
}
sc = sc->texturechain;
}
glDepthRange (gldepthmin, gldepthmax);
qfglDepthRange (gldepthmin, gldepthmax);
} else {
glDisable (GL_BLEND);
glDisable (GL_TEXTURE_2D);
glColor3f (0, 0, 0);
qfglDisable (GL_BLEND);
qfglDisable (GL_TEXTURE_2D);
qfglColor3f (0, 0, 0);
while (sc) {
glpoly_t *p = sc->polys;
@ -705,51 +705,51 @@ R_DrawSkyChain (msurface_t *sky_chain)
}
sc = sc->texturechain;
}
glEnable (GL_TEXTURE_2D);
glEnable (GL_BLEND);
qfglEnable (GL_TEXTURE_2D);
qfglEnable (GL_BLEND);
}
#if 0
// 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;
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
int i;
glBegin (GL_POLYGON);
qfglBegin (GL_POLYGON);
for (i = 0; i < p->numverts; i++) {
glVertex3fv (p->verts[i]);
qfglVertex3fv (p->verts[i]);
}
glEnd ();
qfglEnd ();
p = p->next;
}
sc = sc->texturechain;
}
#endif
glColor3ubv (lighthalf_v);
qfglColor3ubv (lighthalf_v);
#if 0
glDisable (GL_TEXTURE_2D);
qfglDisable (GL_TEXTURE_2D);
sc = sky_chain;
glColor3f (1, 1, 1);
qfglColor3f (1, 1, 1);
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
int i;
glBegin (GL_LINE_LOOP);
qfglBegin (GL_LINE_LOOP);
for (i = 0; i < p->numverts; i++) {
glVertex3fv (p->verts[i]);
qfglVertex3fv (p->verts[i]);
}
glEnd ();
qfglEnd ();
p = p->next;
}
sc = sc->texturechain;
}
sc = sky_chain;
glColor3f (0, 1, 0);
glBegin (GL_POINTS);
qfglColor3f (0, 1, 0);
qfglBegin (GL_POINTS);
while (sc) {
glpoly_t *p = sc->polys;
@ -763,29 +763,29 @@ R_DrawSkyChain (msurface_t *sky_chain)
}
VectorScale (c, 1.0 / p->numverts, c);
VectorAdd (c, r_refdef.vieworg, c);
glVertex3fv (c);
qfglVertex3fv (c);
p = p->next;
}
sc = sc->texturechain;
}
glEnd ();
qfglEnd ();
if (skyloaded) {
int i, j;
glColor3f (1, 0, 0);
qfglColor3f (1, 0, 0);
for (i = 0; i < 6; i++) {
vec3_t v;
glBegin (GL_LINE_LOOP);
qfglBegin (GL_LINE_LOOP);
for (j = 0; j < 4; j++) {
memcpy (v, &skyvec[i][j][2], sizeof (v));
VectorAdd (v, r_refdef.vieworg, v);
glVertex3fv (v);
qfglVertex3fv (v);
}
glEnd ();
qfglEnd ();
}
}
glColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D);
qfglColor3ubv (lighthalf_v);
qfglEnable (GL_TEXTURE_2D);
#endif
}

View file

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

View file

@ -208,7 +208,7 @@ EmitWaterPolys (msurface_t *fa)
vec3_t nv;
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) {
os = v[3];
ot = v[4];
@ -219,7 +219,7 @@ EmitWaterPolys (msurface_t *fa)
t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255];
t *= (1.0 / 64);
glTexCoord2f (s, t);
qfglTexCoord2f (s, t);
VectorCopy (v, nv);
nv[2] += r_waterripple->value
@ -227,8 +227,8 @@ EmitWaterPolys (msurface_t *fa)
* turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255]
* (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);
Sys_Quit ();
exit (sig);
abort(); // Hopefully not an infinite loop.
// exit (sig);
// XCloseDisplay(x_disp);
// VID_Shutdown();
// 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;
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);

View file

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

View file

@ -121,7 +121,7 @@ CheckMultiTextureExtensions (void)
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) {
Con_Printf ("enabled, %d TMUs.\n", max_texture_units);
qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB");
@ -231,36 +231,36 @@ GL_Init_Common (void)
return;
}
gl_vendor = glGetString (GL_VENDOR);
gl_vendor = qfglGetString (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);
gl_version = glGetString (GL_VERSION);
gl_version = qfglGetString (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);
glClearColor (0, 0, 0, 0);
glCullFace (GL_FRONT);
glEnable (GL_TEXTURE_2D);
qfglClearColor (0, 0, 0, 0);
qfglCullFace (GL_FRONT);
qfglEnable (GL_TEXTURE_2D);
glEnable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.666);
qfglEnable (GL_ALPHA_TEST);
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);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (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_MIN_FILTER, gl_filter_min);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
qfglEnable (GL_BLEND);
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 ();
}
@ -315,7 +315,7 @@ Tdfx_Init8bitPalette (void)
table[i][3] = 255;
oldpal++;
}
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
qfglEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
qgl3DfxSetPaletteEXT ((GLuint *) table);
is8bit = true;
} else {
@ -351,7 +351,7 @@ Shared_Init8bitPalette (void)
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;
newPalette = thePalette;
for (i = 0; i < 256; i++) {

View file

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

View file

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