]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
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 4e8b7186443b58a971bd96acffd176d5128559b6..f8c920005459347bc28d3e4ceb53d941ac9ab500 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;
 
        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)
        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);
                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
        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)
 {
 
 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);
        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 (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);
        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 (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);
        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++];
 
        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);
 
        free(trans);
 
+       if (!r_render.value)
+               return;
+       glBindTexture(GL_TEXTURE_2D, c);
        glColor3f(1,1,1);
        glBegin (GL_QUADS);
        glTexCoord2f (0, 0);
        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)
 {
 */
 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);
 
        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)
 {
 */
 void GL_Set2D (void)
 {
+       if (!r_render.value)
+               return;
        glViewport (glx, gly, glwidth, glheight);
 
        glMatrixMode(GL_PROJECTION);
        glViewport (glx, gly, glwidth, glheight);
 
        glMatrixMode(GL_PROJECTION);
index bd48bb467434e67a8ed38f8cffab11a0f2733f84..2aaa9a34ce0bf46d95d8d01a9b741cfe06f74f38 100644 (file)
@@ -151,6 +151,8 @@ extern qboolean lighthalf;
 void GL_DrawModelMesh(int skin, byte *colors, maliashdr_t *maliashdr)
 {
        int i;
 void GL_DrawModelMesh(int skin, byte *colors, maliashdr_t *maliashdr)
 {
        int i;
+       if (!r_render.value)
+               return;
        glBindTexture(GL_TEXTURE_2D, skin);
        if (!colors)
        {
        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
        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);
 
        }
 
        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)
        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;
 
        float lerp;
        md2memframe_t *frame1, *frame2;
 
-       glBindTexture(GL_TEXTURE_2D, skin);
+       if (r_render.value)
+               glBindTexture(GL_TEXTURE_2D, skin);
 
        softwaretransformforentity(ent);
 
 
        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);
 
 
        R_LightModel(pheader->num_xyz, org, color);
 
+       if (!r_render.value)
+               return;
        if (gl_vertexarrays.value)
        {
                // LordHavoc: big mess...
        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);
        }
 
                        R_LightPoint (color, org);
        }
 
-       glDisable(GL_ALPHA_TEST);
+       if (r_render.value)
+               glDisable(GL_ALPHA_TEST);
 
        if (frame < 0 || frame >= clmodel->numframes)
        {
 
        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;
        }
 
                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)
 
        c_alias_polys += clmodel->numtris;
        if (clmodel->aliastype == ALIASTYPE_MD2)
index 9750a3466f7484dd8b3fdd658d66e965244fe86e..577a8bc1676dd8d8d1a43a7129b88dd6bd9bf31e 100644 (file)
--- a/gl_poly.c
+++ b/gl_poly.c
@@ -368,6 +368,8 @@ void transpolyrender()
 {
        int i, j, tpolytype, texnum;
        transpoly_t *p;
 {
        int i, j, tpolytype, texnum;
        transpoly_t *p;
+       if (!r_render.value)
+               return;
        if (currenttranspoly < 1)
                return;
 //     transpolyrenderminmax();
        if (currenttranspoly < 1)
                return;
 //     transpolyrenderminmax();
@@ -570,6 +572,8 @@ void wallpolyrender()
        int i, j, texnum, lighttexnum;
        wallpoly_t *p;
        wallvert_t *vert;
        int i, j, texnum, lighttexnum;
        wallpoly_t *p;
        wallvert_t *vert;
+       if (!r_render.value)
+               return;
        if (currentwallpoly < 1)
                return;
        c_brush_polys += currentwallpoly;
        if (currentwallpoly < 1)
                return;
        c_brush_polys += currentwallpoly;
@@ -793,6 +797,8 @@ void skypolyrender()
        skyvert_t *vert;
        float length, speedscale;
        vec3_t dir;
        skyvert_t *vert;
        float length, speedscale;
        vec3_t dir;
+       if (!r_render.value)
+               return;
        if (currentskypoly < 1)
                return;
        // testing
        if (currentskypoly < 1)
                return;
        // testing
index 94cf4e36b94a8056e34c5eb404a8ee80f4da0717..64b0e9b85df044a45684f37323e15fe12c7bf9ad 100644 (file)
@@ -131,6 +131,8 @@ void FOG_framebegin()
        }
        if (glfog.value)
        {
        }
        if (glfog.value)
        {
+               if (!r_render.value)
+                       return;
                if(fog_density)
                {
                        // LordHavoc: Borland C++ 5.0 was choking on this line, stupid compiler...
                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;
 
        extern  int glwidth, glheight;
        int             x, x2, y2, y, w, h;
 
+       if (!r_render.value)
+               return;
        //
        // set up viewpoint
        //
        //
        // set up viewpoint
        //
@@ -715,6 +719,8 @@ R_Clear
 */
 void R_Clear (void)
 {
 */
 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;
 //     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()
 {
 // 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);
        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()
 {
 
 void GL_BlendView()
 {
+       if (!r_render.value)
+               return;
        glMatrixMode(GL_PROJECTION);
     glLoadIdentity ();
        glOrtho  (0, vid.width, vid.height, 0, -99999, 99999);
        glMatrixMode(GL_PROJECTION);
     glLoadIdentity ();
        glOrtho  (0, vid.width, vid.height, 0, -99999, 99999);
index 99ff6ecb7fe2fde8b2feebc72c4ffe350e489397..df8ffdd3d27f41bb4ae4280d169e2379f2635880 100644 (file)
@@ -68,6 +68,9 @@ void R_Envmap_f (void)
 {
        byte    buffer[256*256*4];
 
 {
        byte    buffer[256*256*4];
 
+       if (!r_render.value)
+               return;
+
        glDrawBuffer  (GL_FRONT);
        glReadBuffer  (GL_FRONT);
        envmap = true;
        glDrawBuffer  (GL_FRONT);
        glReadBuffer  (GL_FRONT);
        envmap = true;
index 29c3d4d1ac887ee4b398707a78f699225f4e71b5..7b99dbd6967ac106d31c517fccabf300a1c5bcae 100644 (file)
@@ -223,7 +223,8 @@ void R_UpdateLightmap(msurface_t *s, int lnum)
 {
        int smax, tmax;
        // upload the new lightmap texture fragment
 {
        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)
        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);
                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);
                }
                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])
                        {
                {
                        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
                                        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;
                                }
                        }
                        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));
                {
                        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++)
                }
 
                for (i=0 ; i<w ; i++)
@@ -1272,12 +1281,14 @@ void GL_CreateSurfaceLightmap (msurface_t *surf)
        if (lightmaprgba)
        {
                R_BuildLightMap (surf, templight, smax * 4);
        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);
        }
        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 (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;
                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 a5e7d733b5caaf0337e5c6a7c7d66dcdc53280bb..fed3a177523daa7190799c335eb73aa2bf09768e 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         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;
 
 
 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 (&scr_centertime);
        Cvar_RegisterVariable (&scr_printspeed);
        Cvar_RegisterVariable (&showfps);
+       Cvar_RegisterVariable (&r_render);
+#ifdef NORENDER
+       r_render.value = 0;
+#endif
 
 //
 // register our commands
 
 //
 // register our commands
@@ -632,7 +637,8 @@ void SCR_ScreenShot_f (void)
        buffer[15] = glheight>>8;
        buffer[16] = 24;        // pixel size
 
        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;
 
        // swap rgb to bgr
        c = 18+glwidth*glheight*3;
@@ -802,6 +808,8 @@ extern cvar_t gl_lightmode;
 void GL_BrightenScreen()
 {
        float f;
 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);
        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 ();
 
        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
 
 //
 // 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()
 {
 // for profiling, this is seperated
 void GL_Finish()
 {
+       if (!r_render.value)
+               return;
        glFinish ();
 }
 
        glFinish ();
 }
 
index 7534ab4bd28ec00460eb42ea903550ffd49d9fa9..345a7414eb656c70e4c0852fc9785125994606b9 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         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;
 
 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;
 
        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++)
        {
        // 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 (&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"))
 
        // 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;
 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;
        glBindTexture(GL_TEXTURE_2D, glt->texnum);
        width = glt->width;
        height = glt->height;
index 812b82a6bbfe9a01e3df1c9f53e6b1461f015403..ecafc3aa271c9bc4a928b72c35218e8202afa83a 100644 (file)
--- a/gl_warp.c
+++ b/gl_warp.c
@@ -405,6 +405,8 @@ void R_SkyDome()
 
 void R_Sky()
 {
 
 void R_Sky()
 {
+       if (!r_render.value)
+               return;
        if (!skyname[0])
                return;
        glDisable(GL_DEPTH_TEST);
        if (!skyname[0])
                return;
        glDisable(GL_DEPTH_TEST);
index d58f2be504e07e5ada8ef806eb730fc6b16d892f..11d191f9b98b3845a64b2037673a3a73b8297f44 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);
 #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 74065d4f9a7cfa63556f9a6191ced53db52c3f28..cca4f25dd546fef8a00da6b7a2541f98f4eaf40a 100644 (file)
@@ -269,6 +269,8 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height)
 
 void GL_EndRendering (void)
 {
 
 void GL_EndRendering (void)
 {
+       if (!r_render.value)
+               return;
        glFlush();
        fxMesaSwapBuffers();
 }
        glFlush();
        fxMesaSwapBuffers();
 }
index 6ac56f8b3a25e6b973006ae527a3ecc0345c226b..60355ddef3665562ee2fedbc6790ac93339af41d 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)
 {
 
 void GL_EndRendering (void)
 {
+       if (!r_render.value)
+               return;
        glFlush();
        glXSwapBuffers(dpy, win);
 }
        glFlush();
        glXSwapBuffers(dpy, win);
 }
index 374a7d815d9c5c18da740cc00645c7610570e9d6..28d1b4d37a7b29f7b695b2264c0273446b676d73 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)
 {
 
 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
                SwapBuffers(maindc);
 
 // handle the mouse state when windowed if that's changed