implemented r_render and r_upload cvar options for CPU profiling (not hardware bound...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 18 Nov 2000 09:53:29 +0000 (09:53 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 18 Nov 2000 09:53:29 +0000 (09:53 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@88 d7cf8633-e32d-0410-b094-e92efae38249

13 files changed:
gl_draw.c
gl_models.c
gl_poly.c
gl_rmain.c
gl_rmisc.c
gl_rsurf.c
gl_screen.c
gl_textures.c
gl_warp.c
glquake.h
vid_3dfxsvga.c
vid_glx.c
vid_wgl.c

index 4e8b718..f8c9200 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -378,6 +378,8 @@ void Draw_Character (int x, int y, int num)
        fcol = col*0.0625;
        size = 0.0625;
 
+       if (!r_render.value)
+               return;
        glBindTexture(GL_TEXTURE_2D, char_texture);
        // LordHavoc: NEAREST mode on text if not scaling up
        if ((int) vid.width < glwidth)
@@ -419,6 +421,8 @@ void Draw_String (int x, int y, char *str, int maxlen)
                maxlen = strlen(str);
        else if (maxlen > (int) strlen(str))
                maxlen = strlen(str);
+       if (!r_render.value)
+               return;
        glBindTexture(GL_TEXTURE_2D, char_texture);
 
        // LordHavoc: NEAREST mode on text if not scaling up
@@ -456,6 +460,8 @@ void Draw_String (int x, int y, char *str, int maxlen)
 
 void Draw_GenericPic (int texnum, float red, float green, float blue, float alpha, float x, float y, float width, float height)
 {
+       if (!r_render.value)
+               return;
        glDisable(GL_ALPHA_TEST);
 //     glEnable (GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -490,6 +496,8 @@ void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha)
        if (scrap_dirty)
                Scrap_Upload ();
        gl = (glpic_t *)pic->data;
+       if (!r_render.value)
+               return;
        glColor4f(1,1,1,alpha);
        glBindTexture(GL_TEXTURE_2D, gl->texnum);
        glBegin (GL_QUADS);
@@ -517,6 +525,8 @@ void Draw_Pic (int x, int y, qpic_t *pic)
        if (scrap_dirty)
                Scrap_Upload ();
        gl = (glpic_t *)pic->data;
+       if (!r_render.value)
+               return;
        glColor3f(1,1,1);
        glBindTexture(GL_TEXTURE_2D, gl->texnum);
        glBegin (GL_QUADS);
@@ -550,9 +560,12 @@ void Draw_PicTranslate (int x, int y, qpic_t *pic, byte *translation)
        for (i = 0;i < c;i++)
                *dest++ = translation[*src++];
 
-       glBindTexture(GL_TEXTURE_2D, GL_LoadTexture ("translatedplayerpic", pic->width, pic->height, trans, false, true, 1));
+       c = GL_LoadTexture ("translatedplayerpic", pic->width, pic->height, trans, false, true, 1);
        free(trans);
 
+       if (!r_render.value)
+               return;
+       glBindTexture(GL_TEXTURE_2D, c);
        glColor3f(1,1,1);
        glBegin (GL_QUADS);
        glTexCoord2f (0, 0);
@@ -596,6 +609,8 @@ Fills a box of pixels with a single color
 */
 void Draw_Fill (int x, int y, int w, int h, int c)
 {
+       if (!r_render.value)
+               return;
        glDisable (GL_TEXTURE_2D);
        glColor3f (host_basepal[c*3]/255.0, host_basepal[c*3+1]/255.0, host_basepal[c*3+2]/255.0);
 
@@ -623,6 +638,8 @@ Setup as if the screen was 320*200
 */
 void GL_Set2D (void)
 {
+       if (!r_render.value)
+               return;
        glViewport (glx, gly, glwidth, glheight);
 
        glMatrixMode(GL_PROJECTION);
index bd48bb4..2aaa9a3 100644 (file)
@@ -151,6 +151,8 @@ extern qboolean lighthalf;
 void GL_DrawModelMesh(int skin, byte *colors, maliashdr_t *maliashdr)
 {
        int i;
+       if (!r_render.value)
+               return;
        glBindTexture(GL_TEXTURE_2D, skin);
        if (!colors)
        {
@@ -255,14 +257,19 @@ void R_DrawAliasFrame (maliashdr_t *maliashdr, float alpha, vec3_t color, entity
        R_AliasLerpVerts(maliashdr->numverts, lerp, (trivert2 *)((int) maliashdr + maliashdr->posedata) + ent->draw_lastpose * maliashdr->numverts, maliashdr->scale, maliashdr->scale_origin, (trivert2 *)((int) maliashdr + maliashdr->posedata) + ent->draw_pose * maliashdr->numverts, maliashdr->scale, maliashdr->scale_origin);
 
        // prep the vertex array as early as possible
-       if (gl_vertexarrays.value)
+       if (r_render.value)
        {
-               qglVertexPointer(3, GL_FLOAT, 0, aliasvert);
-               glEnableClientState(GL_VERTEX_ARRAY);
+               if (gl_vertexarrays.value)
+               {
+                       qglVertexPointer(3, GL_FLOAT, 0, aliasvert);
+                       glEnableClientState(GL_VERTEX_ARRAY);
+               }
        }
 
        R_LightModel(maliashdr->numverts, org, color);
 
+       if (!r_render.value)
+               return;
        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
        glShadeModel(GL_SMOOTH);
        if (effects & EF_ADDITIVE)
@@ -401,7 +408,8 @@ void R_DrawQ2AliasFrame (md2mem_t *pheader, float alpha, vec3_t color, entity_t
        float lerp;
        md2memframe_t *frame1, *frame2;
 
-       glBindTexture(GL_TEXTURE_2D, skin);
+       if (r_render.value)
+               glBindTexture(GL_TEXTURE_2D, skin);
 
        softwaretransformforentity(ent);
 
@@ -419,6 +427,8 @@ void R_DrawQ2AliasFrame (md2mem_t *pheader, float alpha, vec3_t color, entity_t
 
        R_LightModel(pheader->num_xyz, org, color);
 
+       if (!r_render.value)
+               return;
        if (gl_vertexarrays.value)
        {
                // LordHavoc: big mess...
@@ -666,7 +676,8 @@ void R_DrawAliasModel (entity_t *ent, int cull, float alpha, model_t *clmodel, i
                        R_LightPoint (color, org);
        }
 
-       glDisable(GL_ALPHA_TEST);
+       if (r_render.value)
+               glDisable(GL_ALPHA_TEST);
 
        if (frame < 0 || frame >= clmodel->numframes)
        {
@@ -693,7 +704,8 @@ void R_DrawAliasModel (entity_t *ent, int cull, float alpha, model_t *clmodel, i
                skinset = skinanim + i*5;
        }
 
-       glEnable (GL_TEXTURE_2D);
+       if (r_render.value)
+               glEnable (GL_TEXTURE_2D);
 
        c_alias_polys += clmodel->numtris;
        if (clmodel->aliastype == ALIASTYPE_MD2)
index 9750a34..577a8bc 100644 (file)
--- a/gl_poly.c
+++ b/gl_poly.c
@@ -368,6 +368,8 @@ void transpolyrender()
 {
        int i, j, tpolytype, texnum;
        transpoly_t *p;
+       if (!r_render.value)
+               return;
        if (currenttranspoly < 1)
                return;
 //     transpolyrenderminmax();
@@ -570,6 +572,8 @@ void wallpolyrender()
        int i, j, texnum, lighttexnum;
        wallpoly_t *p;
        wallvert_t *vert;
+       if (!r_render.value)
+               return;
        if (currentwallpoly < 1)
                return;
        c_brush_polys += currentwallpoly;
@@ -793,6 +797,8 @@ void skypolyrender()
        skyvert_t *vert;
        float length, speedscale;
        vec3_t dir;
+       if (!r_render.value)
+               return;
        if (currentskypoly < 1)
                return;
        // testing
index 94cf4e3..64b0e9b 100644 (file)
@@ -131,6 +131,8 @@ void FOG_framebegin()
        }
        if (glfog.value)
        {
+               if (!r_render.value)
+                       return;
                if(fog_density)
                {
                        // LordHavoc: Borland C++ 5.0 was choking on this line, stupid compiler...
@@ -637,6 +639,8 @@ void R_SetupGL (void)
        extern  int glwidth, glheight;
        int             x, x2, y2, y, w, h;
 
+       if (!r_render.value)
+               return;
        //
        // set up viewpoint
        //
@@ -715,6 +719,8 @@ R_Clear
 */
 void R_Clear (void)
 {
+       if (!r_render.value)
+               return;
 //     glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // LordHavoc: moved to SCR_UpdateScreen
        gldepthmin = 0;
        gldepthmax = 1;
@@ -726,6 +732,8 @@ void R_Clear (void)
 // LordHavoc: my trick to *FIX* GLQuake lighting once and for all :)
 void GL_Brighten()
 {
+       if (!r_render.value)
+               return;
        glMatrixMode(GL_PROJECTION);
     glLoadIdentity ();
        glOrtho  (0, vid.width, vid.height, 0, -99999, 99999);
@@ -755,6 +763,8 @@ extern cvar_t gl_lightmode;
 
 void GL_BlendView()
 {
+       if (!r_render.value)
+               return;
        glMatrixMode(GL_PROJECTION);
     glLoadIdentity ();
        glOrtho  (0, vid.width, vid.height, 0, -99999, 99999);
index 99ff6ec..df8ffdd 100644 (file)
@@ -68,6 +68,9 @@ void R_Envmap_f (void)
 {
        byte    buffer[256*256*4];
 
+       if (!r_render.value)
+               return;
+
        glDrawBuffer  (GL_FRONT);
        glReadBuffer  (GL_FRONT);
        envmap = true;
index 29c3d4d..7b99dbd 100644 (file)
@@ -223,7 +223,8 @@ void R_UpdateLightmap(msurface_t *s, int lnum)
 {
        int smax, tmax;
        // upload the new lightmap texture fragment
-       glBindTexture(GL_TEXTURE_2D, lightmap_textures + lnum);
+       if(r_upload.value)
+               glBindTexture(GL_TEXTURE_2D, lightmap_textures + lnum);
        if (nosubimage || nosubimagefragments)
        {
                if (lightmapupdate[lnum][0] > s->light_t)
@@ -242,12 +243,14 @@ void R_UpdateLightmap(msurface_t *s, int lnum)
                if (lightmaprgba)
                {
                        R_BuildLightMap (s, templight, smax * 4);
-                       glTexSubImage2D(GL_TEXTURE_2D, 0, s->light_s, s->light_t, smax, tmax, GL_RGBA, GL_UNSIGNED_BYTE, templight);
+                       if(r_upload.value)
+                               glTexSubImage2D(GL_TEXTURE_2D, 0, s->light_s, s->light_t, smax, tmax, GL_RGBA, GL_UNSIGNED_BYTE, templight);
                }
                else
                {
                        R_BuildLightMap (s, templight, smax * 3);
-                       glTexSubImage2D(GL_TEXTURE_2D, 0, s->light_s, s->light_t, smax, tmax, GL_RGB , GL_UNSIGNED_BYTE, templight);
+                       if(r_upload.value)
+                               glTexSubImage2D(GL_TEXTURE_2D, 0, s->light_s, s->light_t, smax, tmax, GL_RGB , GL_UNSIGNED_BYTE, templight);
                }
        }
 }
@@ -331,20 +334,23 @@ void UploadLightmaps()
                {
                        if (lightmapupdate[i][0] < lightmapupdate[i][1])
                        {
-                               glBindTexture(GL_TEXTURE_2D, lightmap_textures + i);
-                               if (nosubimage)
-                               {
-                                       if (lightmaprgba)
-                                               glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightmaps[i]);
-                                       else
-                                               glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i]);
-                               }
-                               else
+                               if(r_upload.value)
                                {
-                                       if (lightmaprgba)
-                                               glTexSubImage2D(GL_TEXTURE_2D, 0, 0, lightmapupdate[i][0], BLOCK_WIDTH, lightmapupdate[i][1] - lightmapupdate[i][0], GL_RGBA, GL_UNSIGNED_BYTE, lightmaps[i] + (BLOCK_WIDTH * 4 * lightmapupdate[i][0]));
+                                       glBindTexture(GL_TEXTURE_2D, lightmap_textures + i);
+                                       if (nosubimage)
+                                       {
+                                               if (lightmaprgba)
+                                                       glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightmaps[i]);
+                                               else
+                                                       glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i]);
+                                       }
                                        else
-                                               glTexSubImage2D(GL_TEXTURE_2D, 0, 0, lightmapupdate[i][0], BLOCK_WIDTH, lightmapupdate[i][1] - lightmapupdate[i][0], GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i] + (BLOCK_WIDTH * 3 * lightmapupdate[i][0]));
+                                       {
+                                               if (lightmaprgba)
+                                                       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, lightmapupdate[i][0], BLOCK_WIDTH, lightmapupdate[i][1] - lightmapupdate[i][0], GL_RGBA, GL_UNSIGNED_BYTE, lightmaps[i] + (BLOCK_WIDTH * 4 * lightmapupdate[i][0]));
+                                               else
+                                                       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, lightmapupdate[i][0], BLOCK_WIDTH, lightmapupdate[i][1] - lightmapupdate[i][0], GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i] + (BLOCK_WIDTH * 3 * lightmapupdate[i][0]));
+                                       }
                                }
                        }
                        lightmapupdate[i][0] = BLOCK_HEIGHT;
@@ -1111,13 +1117,16 @@ int AllocBlock (int w, int h, short *x, short *y)
                {
                        byte blank[BLOCK_WIDTH*BLOCK_HEIGHT*3];
                        memset(blank, 0, sizeof(blank));
-                       glBindTexture(GL_TEXTURE_2D, lightmap_textures + texnum);
-                       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-                       glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-                       if (lightmaprgba)
-                               glTexImage2D (GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, blank);
-                       else
-                               glTexImage2D (GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, blank);
+                       if(r_upload.value)
+                       {
+                               glBindTexture(GL_TEXTURE_2D, lightmap_textures + texnum);
+                               glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+                               glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+                               if (lightmaprgba)
+                                       glTexImage2D (GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, blank);
+                               else
+                                       glTexImage2D (GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, blank);
+                       }
                }
 
                for (i=0 ; i<w ; i++)
@@ -1272,12 +1281,14 @@ void GL_CreateSurfaceLightmap (msurface_t *surf)
        if (lightmaprgba)
        {
                R_BuildLightMap (surf, templight, smax * 4);
-               glTexSubImage2D(GL_TEXTURE_2D, 0, surf->light_s, surf->light_t, smax, tmax, GL_RGBA, GL_UNSIGNED_BYTE, templight);
+               if(r_upload.value)
+                       glTexSubImage2D(GL_TEXTURE_2D, 0, surf->light_s, surf->light_t, smax, tmax, GL_RGBA, GL_UNSIGNED_BYTE, templight);
        }
        else
        {
                R_BuildLightMap (surf, templight, smax * 3);
-               glTexSubImage2D(GL_TEXTURE_2D, 0, surf->light_s, surf->light_t, smax, tmax, GL_RGB , GL_UNSIGNED_BYTE, templight);
+               if(r_upload.value)
+                       glTexSubImage2D(GL_TEXTURE_2D, 0, surf->light_s, surf->light_t, smax, tmax, GL_RGB , GL_UNSIGNED_BYTE, templight);
        }
 }
 
@@ -1366,24 +1377,29 @@ void GL_BuildLightmaps (void)
 
        if (nosubimage || nosubimagefragments)
        {
-               if (gl_mtexable)
-                       qglSelectTexture(gl_mtex_enum+1);
+               if(r_upload.value)
+                       if (gl_mtexable)
+                               qglSelectTexture(gl_mtex_enum+1);
                for (i = 0;i < MAX_LIGHTMAPS;i++)
                {
                        if (!allocated[i][0])
                                break;
                        lightmapupdate[i][0] = BLOCK_HEIGHT;
                        lightmapupdate[i][1] = 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);
-                       if (lightmaprgba)
-                               glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightmaps[i]);
-                       else
-                               glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i]);
+                       if(r_upload.value)
+                       {
+                               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);
+                               if (lightmaprgba)
+                                       glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, lightmaps[i]);
+                               else
+                                       glTexImage2D(GL_TEXTURE_2D, 0, 3, BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i]);
+                       }
                }
-               if (gl_mtexable)
-                       qglSelectTexture(gl_mtex_enum+0);
+               if(r_upload.value)
+                       if (gl_mtexable)
+                               qglSelectTexture(gl_mtex_enum+0);
        }
 }
 
index a5e7d73..fed3a17 100644 (file)
@@ -89,6 +89,7 @@ cvar_t                scr_showturtle = {"showturtle","0"};
 cvar_t         scr_showpause = {"showpause","1"};
 cvar_t         scr_printspeed = {"scr_printspeed","8"};
 cvar_t         showfps = {"showfps", "0", true};
+cvar_t         r_render = {"r_render", "1"};
 
 extern cvar_t  crosshair;
 
@@ -397,6 +398,10 @@ void GL_Screen_Init (void)
        Cvar_RegisterVariable (&scr_centertime);
        Cvar_RegisterVariable (&scr_printspeed);
        Cvar_RegisterVariable (&showfps);
+       Cvar_RegisterVariable (&r_render);
+#ifdef NORENDER
+       r_render.value = 0;
+#endif
 
 //
 // register our commands
@@ -632,7 +637,8 @@ void SCR_ScreenShot_f (void)
        buffer[15] = glheight>>8;
        buffer[16] = 24;        // pixel size
 
-       glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); 
+       if (r_render.value)
+               glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); 
 
        // swap rgb to bgr
        c = 18+glwidth*glheight*3;
@@ -802,6 +808,8 @@ extern cvar_t gl_lightmode;
 void GL_BrightenScreen()
 {
        float f;
+       if (!r_render.value)
+               return;
        glDisable(GL_TEXTURE_2D);
        glEnable(GL_BLEND);
        f = brightness.value = bound(1.0f, brightness.value, 5.0f);
@@ -901,8 +909,11 @@ void SCR_UpdateScreen (void)
        if (vid.recalc_refdef)
                SCR_CalcRefdef ();
 
-       glClearColor(0,0,0,0);
-       glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // LordHavoc: clear the screen (around the view as well)
+       if (r_render.value)
+       {
+               glClearColor(0,0,0,0);
+               glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // LordHavoc: clear the screen (around the view as well)
+       }
 
 //
 // do 3D refresh drawing, and then update the screen
@@ -980,6 +991,8 @@ void SCR_UpdateScreen (void)
 // for profiling, this is seperated
 void GL_Finish()
 {
+       if (!r_render.value)
+               return;
        glFinish ();
 }
 
index 7534ab4..345a741 100644 (file)
@@ -3,6 +3,7 @@
 cvar_t         gl_max_size = {"gl_max_size", "1024"};
 cvar_t         gl_picmip = {"gl_picmip", "0"};
 cvar_t         gl_lerpimages = {"gl_lerpimages", "1"};
+cvar_t         r_upload = {"r_upload", "1"};
 
 int            gl_filter_min = GL_LINEAR_MIPMAP_LINEAR; //NEAREST;
 int            gl_filter_max = GL_LINEAR;
@@ -83,6 +84,8 @@ void Draw_TextureMode_f (void)
        gl_filter_min = modes[i].minimize;
        gl_filter_max = modes[i].maximize;
 
+       if (!r_upload.value)
+               return;
        // change all the existing mipmap texture objects
        for (i=0, glt=gltextures ; i<numgltextures ; i++, glt++)
        {
@@ -117,6 +120,10 @@ void GL_Textures_Init (void)
        Cvar_RegisterVariable (&gl_max_size);
        Cvar_RegisterVariable (&gl_picmip);
        Cvar_RegisterVariable (&gl_lerpimages);
+       Cvar_RegisterVariable (&r_upload);
+#ifdef NORENDER
+       r_upload.value = 0;
+#endif
 
        // 3dfx can only handle 256 wide textures
        if (!Q_strncasecmp ((char *)gl_renderer, "3dfx",4) || strstr((char *)gl_renderer, "Glide"))
@@ -728,6 +735,8 @@ void GL_MipReduce(byte *in, byte *out, int width, int height, int destwidth, int
 void GL_UploadTexture (gltexture_t *glt)
 {
        int mip, width, height;
+       if (!r_upload.value)
+               return;
        glBindTexture(GL_TEXTURE_2D, glt->texnum);
        width = glt->width;
        height = glt->height;
index 812b82a..ecafc3a 100644 (file)
--- a/gl_warp.c
+++ b/gl_warp.c
@@ -405,6 +405,8 @@ void R_SkyDome()
 
 void R_Sky()
 {
+       if (!r_render.value)
+               return;
        if (!skyname[0])
                return;
        glDisable(GL_DEPTH_TEST);
index d58f2be..11d191f 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -242,3 +242,6 @@ extern vec_t fogdensity;
 #include "r_modules.h"
 
 extern void R_DrawAliasModel (entity_t *ent, int cull, float alpha, model_t *clmodel, int frame, int skin, vec3_t org, int effects, int flags, int colormap);
+
+extern cvar_t r_render;
+extern cvar_t r_upload;
index 74065d4..cca4f25 100644 (file)
@@ -269,6 +269,8 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height)
 
 void GL_EndRendering (void)
 {
+       if (!r_render.value)
+               return;
        glFlush();
        fxMesaSwapBuffers();
 }
index 6ac56f8..60355dd 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -622,6 +622,8 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height)
 
 void GL_EndRendering (void)
 {
+       if (!r_render.value)
+               return;
        glFlush();
        glXSwapBuffers(dpy, win);
 }
index 374a7d8..28d1b4d 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -595,7 +595,7 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height)
 
 void GL_EndRendering (void)
 {
-       if (!scr_skipupdate)
+       if (r_render.value && !scr_skipupdate)
                SwapBuffers(maindc);
 
 // handle the mouse state when windowed if that's changed