]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added polygonoffset as a texture property, used on submodels (such as
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 May 2007 06:46:44 +0000 (06:46 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 27 May 2007 06:46:44 +0000 (06:46 +0000)
doors in q1bsp maps) to prevent zfighting if they exactly overlap a
wall, consistent with software quake (which intentionally removed the
portions of the door overlapping a wall)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7375 d7cf8633-e32d-0410-b094-e92efae38249

12 files changed:
cl_particles.c
cl_screen.c
gl_backend.c
gl_backend.h
gl_draw.c
gl_rmain.c
gl_rsurf.c
model_shared.h
r_explosion.c
r_lightning.c
r_shadow.c
r_sky.c

index 3d9523e8f492a41b26d535ce1ed9e105be9cfd47..06716148f2deffca1eeedb7dee56255bc4372350 100644 (file)
@@ -2180,6 +2180,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
        R_Mesh_ColorPointer(particle_color4f, 0, 0);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(0, 0);
        GL_DepthTest(true);
        GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
 
index 7f53840b751c51e2dad92edf988b9758d3cc8bfa..6599c20f0c7eed9a52c3d073759c779c406dd224 100644 (file)
@@ -1928,6 +1928,7 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        GL_Color(1,1,1,1);
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(0, 0);
        GL_DepthTest(false);
        R_Mesh_VertexPointer(vertex3f, 0, 0);
        R_Mesh_ColorPointer(NULL, 0, 0);
index 4dbdc8ce25c969eb720cd8cad63927fbadd3b187..f4c81f636542af3bd5bab20acec462987328ea34 100644 (file)
@@ -396,6 +396,7 @@ static struct gl_state_s
        int colormask; // stored as bottom 4 bits: r g b a (3 2 1 0 order)
        int depthtest;
        float depthrange[2];
+       float polygonoffset[2];
        int alphatest;
        int scissortest;
        unsigned int unit;
@@ -548,6 +549,8 @@ void GL_Backend_ResetState(void)
        gl_state.lockrange_count = 0;
        gl_state.cullface = v_flipped_state ? GL_BACK : GL_FRONT; // quake is backwards, this culls back faces
        gl_state.cullfaceenable = true;
+       gl_state.polygonoffset[0] = 0;
+       gl_state.polygonoffset[1] = 0;
 
        CHECKGLERROR
 
@@ -561,6 +564,7 @@ void GL_Backend_ResetState(void)
        qglDepthFunc(GL_LEQUAL);CHECKGLERROR
        qglEnable(GL_DEPTH_TEST);CHECKGLERROR
        qglDepthMask(gl_state.depthmask);CHECKGLERROR
+       qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]);
 
        if (gl_support_arb_vertex_buffer_object)
        {
@@ -680,6 +684,16 @@ void GL_DepthRange(float nearfrac, float farfrac)
        }
 }
 
+void GL_PolygonOffset(float planeoffset, float depthoffset)
+{
+       if (gl_state.polygonoffset[0] != planeoffset || gl_state.polygonoffset[1] != depthoffset)
+       {
+               gl_state.polygonoffset[0] = planeoffset;
+               gl_state.polygonoffset[1] = depthoffset;
+               qglPolygonOffset(planeoffset, depthoffset);
+       }
+}
+
 void GL_SetMirrorState(qboolean state)
 {
        if(!state != !v_flipped_state)
index 088cdb32ffdb94990ffc034bd2e1bbbb062f7a90..a8c2c3bf2c49564491fe6af8f097f1b62c1cb85d 100644 (file)
@@ -19,6 +19,7 @@ void GL_BlendFunc(int blendfunc1, int blendfunc2);
 void GL_DepthMask(int state);
 void GL_DepthTest(int state);
 void GL_DepthRange(float nearfrac, float farfrac);
+void GL_PolygonOffset(float planeoffset, float depthoffset);
 void GL_CullFace(int state);
 void GL_AlphaTest(int state);
 void GL_ColorMask(int r, int g, int b, int a);
index 251009ef0ef141c3841d287f32f543e63579fb32..2f4367c1c3fdd07f43f29e0757a16a6f7060ed39 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -550,6 +550,7 @@ static void _DrawQ_Setup(void)
 
        GL_DepthMask(true);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(0, 0);
        GL_DepthTest(false);
        GL_Color(1,1,1,1);
        GL_AlphaTest(false);
@@ -945,6 +946,7 @@ void R_DrawGamma(void)
                R_Mesh_ResetTextureState();
                GL_DepthMask(true);
                GL_DepthRange(0, 1);
+               GL_PolygonOffset(0, 0);
                GL_DepthTest(false);
                if (v_color_enable.integer)
                {
index 2d989ca1be8c8d782cf886483d187bc1a02f60c6..a0bd28084ee083a6a055465552b310ca89e383dd 100644 (file)
@@ -61,6 +61,8 @@ cvar_t r_fullbrights = {CVAR_SAVE, "r_fullbrights", "1", "enables glowing pixels
 cvar_t r_shadows = {CVAR_SAVE, "r_shadows", "0", "casts fake stencil shadows from models onto the world (rtlights are unaffected by this)"};
 cvar_t r_shadows_throwdistance = {CVAR_SAVE, "r_shadows_throwdistance", "500", "how far to cast shadows from models"};
 cvar_t r_q1bsp_skymasking = {0, "r_q1bsp_skymasking", "1", "allows sky polygons in quake1 maps to obscure other geometry"};
+cvar_t r_polygonoffset_submodel_factor = {0, "r_polygonoffset_submodel_factor", "0", "biases depth values of world submodels such as doors, to prevent z-fighting artifacts in Quake maps"};
+cvar_t r_polygonoffset_submodel_offset = {0, "r_polygonoffset_submodel_offset", "2", "biases depth values of world submodels such as doors, to prevent z-fighting artifacts in Quake maps"};
 
 cvar_t gl_fogenable = {0, "gl_fogenable", "0", "nehahra fog enable (for Nehahra compatibility only)"};
 cvar_t gl_fogdensity = {0, "gl_fogdensity", "0.25", "nehahra fog density (recommend values below 0.1) (for Nehahra compatibility only)"};
@@ -1493,6 +1495,8 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable(&r_shadows);
        Cvar_RegisterVariable(&r_shadows_throwdistance);
        Cvar_RegisterVariable(&r_q1bsp_skymasking);
+       Cvar_RegisterVariable(&r_polygonoffset_submodel_factor);
+       Cvar_RegisterVariable(&r_polygonoffset_submodel_offset);
        Cvar_RegisterVariable(&r_textureunits);
        Cvar_RegisterVariable(&r_glsl);
        Cvar_RegisterVariable(&r_glsl_offsetmapping);
@@ -1987,7 +1991,7 @@ void R_ResetViewRendering2D(void)
        GL_DepthTest(false);
        R_Mesh_Matrix(&identitymatrix);
        R_Mesh_ResetTextureState();
-       qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+       GL_PolygonOffset(0, 0);
        qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR
        qglDepthFunc(GL_LEQUAL);CHECKGLERROR
        qglDisable(GL_STENCIL_TEST);CHECKGLERROR
@@ -2020,7 +2024,7 @@ void R_ResetViewRendering3D(void)
        GL_DepthTest(true);
        R_Mesh_Matrix(&identitymatrix);
        R_Mesh_ResetTextureState();
-       qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR
        qglDepthFunc(GL_LEQUAL);CHECKGLERROR
        qglDisable(GL_STENCIL_TEST);CHECKGLERROR
@@ -2734,6 +2738,7 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        R_Mesh_Matrix(&identitymatrix);
        R_Mesh_ResetTextureState();
 
@@ -2870,6 +2875,7 @@ void R_DrawNoModel_TransparentCallback(const entity_render_t *ent, const rtlight
                GL_DepthMask(true);
        }
        GL_DepthRange(0, (ent->flags & RENDER_VIEWMODEL) ? 0.0625 : 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
        GL_CullFace((ent->effects & EF_DOUBLESIDED) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
        R_Mesh_VertexPointer(nomodelvertex3f, 0, 0);
@@ -2966,6 +2972,7 @@ void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_
 
        GL_DepthMask(false);
        GL_DepthRange(0, depthshort ? 0.0625 : 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(!depthdisable);
 
        vertex3f[ 0] = origin[0] + left[0] * scalex2 + up[0] * scaley1;
@@ -3320,6 +3327,17 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                        t->specularscale = r_shadow_gloss2intensity.value;
        }
 
+       t->currentpolygonfactor = r_refdef.polygonfactor;
+       t->currentpolygonoffset = r_refdef.polygonoffset;
+       // submodels are biased to avoid z-fighting with world surfaces that they
+       // may be exactly overlapping (avoids z-fighting artifacts on certain
+       // doors and things in Quake maps)
+       if (ent->model->brush.submodel)
+       {
+               t->currentpolygonfactor = r_refdef.polygonfactor + r_polygonoffset_submodel_factor.value;
+               t->currentpolygonoffset = r_refdef.polygonoffset + r_polygonoffset_submodel_offset.value;
+       }
+
        VectorClear(t->dlightcolor);
        t->currentnumlayers = 0;
        if (!(t->currentmaterialflags & MATERIALFLAG_NODRAW))
@@ -4442,6 +4460,7 @@ static void RSurf_DrawBatch_GL11_VertexShade(int texturenumsurfaces, msurface_t
 static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, msurface_t **texturesurfacelist)
 {
        GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+       GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
        GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
        GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
        if (rsurface.mode != RSURFMODE_SHOWSURFACES)
@@ -4477,6 +4496,7 @@ static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, msurface_t **te
                R_Mesh_Matrix(&rsurface.matrix);
        }
        GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+       GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
        GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
        GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
        GL_DepthMask(true);
@@ -4841,6 +4861,7 @@ static void R_DrawTextureSurfaceList(int texturenumsurfaces, msurface_t **textur
                        GL_Color(1,1,1,1);
                }
                GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+               GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
                GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
                GL_DepthTest(true);
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -4860,6 +4881,7 @@ static void R_DrawTextureSurfaceList(int texturenumsurfaces, msurface_t **textur
                if (rsurface.mode != RSURFMODE_MULTIPASS)
                        rsurface.mode = RSURFMODE_MULTIPASS;
                GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+               GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
                GL_DepthTest(true);
                GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
                GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -4911,6 +4933,7 @@ static void R_DrawTextureSurfaceList(int texturenumsurfaces, msurface_t **textur
                if (!writedepth && (rsurface.texture->currentmaterialflags & (MATERIALFLAG_BLENDED | MATERIALFLAG_ALPHATEST)))
                        writedepth = true;
                GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+               GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
                GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
                GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
                GL_BlendFunc(rsurface.texture->currentlayers[0].blendfunc1, rsurface.texture->currentlayers[0].blendfunc2);
@@ -5050,6 +5073,7 @@ void R_DrawLoc_Callback(const entity_render_t *ent, const rtlight_t *rtlight, in
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        GL_CullFace(GL_NONE);
        R_Mesh_Matrix(&identitymatrix);
@@ -5110,14 +5134,14 @@ void R_DrawCollisionBrushes(entity_render_t *ent)
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
        GL_DepthTest(!r_showdisabledepthtest.integer);
-       qglPolygonOffset(r_refdef.polygonfactor + r_showcollisionbrushes_polygonfactor.value, r_refdef.polygonoffset + r_showcollisionbrushes_polygonoffset.value);CHECKGLERROR
+       GL_PolygonOffset(r_refdef.polygonfactor + r_showcollisionbrushes_polygonfactor.value, r_refdef.polygonoffset + r_showcollisionbrushes_polygonoffset.value);
        for (i = 0, brush = model->brush.data_brushes + model->firstmodelbrush;i < model->nummodelbrushes;i++, brush++)
                if (brush->colbrushf && brush->colbrushf->numtriangles)
                        R_DrawCollisionBrush(brush->colbrushf);
        for (i = 0, surface = model->data_surfaces + model->firstmodelsurface;i < model->nummodelsurfaces;i++, surface++)
                if (surface->num_collisiontriangles)
                        R_DrawCollisionSurface(ent, surface);
-       qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
 }
 
 void R_DrawTrianglesAndNormals(entity_render_t *ent, qboolean drawtris, qboolean drawnormals, int flagsmask)
@@ -5130,6 +5154,7 @@ void R_DrawTrianglesAndNormals(entity_render_t *ent, qboolean drawtris, qboolean
        CHECKGLERROR
        GL_DepthRange(0, 1);
        GL_DepthTest(!r_showdisabledepthtest.integer);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthMask(true);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        R_Mesh_ColorPointer(NULL, 0, 0);
index 6f77b47fe094faac5cb1781d06d3aee1efc656c8..db9cc5459c272b2d191e0e9f6875d942d39f5b2e 100644 (file)
@@ -352,6 +352,7 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, const rtlight_t *r
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        GL_CullFace(GL_NONE);
        R_Mesh_Matrix(&identitymatrix);
index 1ce9f2e525140a076711b381653e3b97a64f83ed..58f15c821fb127b4c1e493b9e951c3d2602473c1 100644 (file)
@@ -411,6 +411,10 @@ typedef struct texture_s
        // current material flags (updated each bmodel render)
        int currentmaterialflags;
 
+       // current PolygonOffset values for rendering this material
+       float currentpolygonfactor;
+       float currentpolygonoffset;
+
        // textures to use when rendering this material
        skinframe_t *currentskinframe;
        int numskinframes;
index f73e5cc9f2664cab90d382ab5391c56a5070f46d..48ce2ef3ec4e3566f524cd74b7085d4633aaff0d 100644 (file)
@@ -188,6 +188,7 @@ static void R_DrawExplosion_TransparentCallback(const entity_render_t *ent, cons
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
        R_Mesh_Matrix(&identitymatrix);
index 76c8ff24f5986bfce3d80e70f34a2c928df6388a..c8ff41f4eb8107dab90ba66459505ef257d23106 100644 (file)
@@ -240,6 +240,7 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, const r
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        if (r_lightningbeam_qmbtexture.integer && r_lightningbeamqmbtexture == NULL)
                r_lightningbeams_setupqmbtexture();
index 377acc5d581e24e21de4d532c8ed8654778f0cd7..aa67549c6ddcd8f1a333f22ac9a255f4dca5d131 100644 (file)
@@ -983,6 +983,7 @@ void R_Shadow_RenderMode_Begin(void)
        R_Mesh_ResetTextureState();
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
        GL_DepthTest(true);
        GL_DepthMask(false);
        GL_Color(0, 0, 0, 1);
@@ -1027,7 +1028,7 @@ void R_Shadow_RenderMode_Reset(void)
        GL_DepthTest(true);
        GL_DepthMask(false);
        qglDepthFunc(GL_LEQUAL);CHECKGLERROR
-       qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+       GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
        qglDisable(GL_STENCIL_TEST);CHECKGLERROR
        qglStencilMask(~0);CHECKGLERROR
        qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);CHECKGLERROR
@@ -1043,7 +1044,7 @@ void R_Shadow_RenderMode_StencilShadowVolumes(qboolean clearstencil)
        CHECKGLERROR
        R_Shadow_RenderMode_Reset();
        GL_ColorMask(0, 0, 0, 0);
-       qglPolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
+       GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
        qglDepthFunc(GL_LESS);CHECKGLERROR
        qglEnable(GL_STENCIL_TEST);CHECKGLERROR
        r_shadow_rendermode = r_shadow_shadowingrendermode;
@@ -1114,7 +1115,7 @@ void R_Shadow_RenderMode_VisibleShadowVolumes(void)
        GL_DepthRange(0, 1);
        GL_DepthTest(r_showshadowvolumes.integer < 2);
        GL_Color(0.0, 0.0125 * r_view.colorscale, 0.1 * r_view.colorscale, 1);
-       qglPolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
+       GL_PolygonOffset(r_refdef.shadowpolygonfactor, r_refdef.shadowpolygonoffset);CHECKGLERROR
        GL_CullFace(GL_NONE);
        r_shadow_rendermode = R_SHADOW_RENDERMODE_VISIBLEVOLUMES;
 }
@@ -2239,6 +2240,7 @@ void R_Shadow_RenderLighting(int firstvertex, int numvertices, int numtriangles,
        if ((ambientscale + diffusescale) * VectorLength2(lightcolorbase) + specularscale * VectorLength2(lightcolorbase) < (1.0f / 1048576.0f))
                return;
        GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
+       GL_PolygonOffset(rsurface.texture->currentpolygonfactor, rsurface.texture->currentpolygonoffset);
        GL_DepthTest(!(rsurface.texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST));
        GL_CullFace((rsurface.texture->currentmaterialflags & MATERIALFLAG_NOCULLFACE) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
        if (rsurface.texture->colormapping)
@@ -3110,7 +3112,7 @@ void R_DrawModelShadows(void)
        GL_DepthRange(0, 1);
        GL_DepthTest(false);
        GL_DepthMask(false);
-       qglPolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);CHECKGLERROR
+       GL_PolygonOffset(0, 0);CHECKGLERROR
        GL_Color(0, 0, 0, 0.5);
        GL_ColorMask(r_view.colormask[0], r_view.colormask[1], r_view.colormask[2], 1);
        qglDepthFunc(GL_ALWAYS);CHECKGLERROR
diff --git a/r_sky.c b/r_sky.c
index e7e5b30bb046a9dcca63d74279bfeda91bcd278d..51caa6cecb4cfb926f8744dabb02c5087b50b050 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -273,6 +273,7 @@ static void R_SkyBox(void)
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(false);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(0, 0);
        GL_DepthTest(false); // don't modify or read zbuffer
        R_Mesh_VertexPointer(skyboxvertex3f, 0, 0);
        R_Mesh_ColorPointer(NULL, 0, 0);
@@ -372,6 +373,7 @@ static void R_SkySphere(void)
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);
        GL_DepthRange(0, 1);
+       GL_PolygonOffset(0, 0);
        GL_DepthTest(false); // don't modify or read zbuffer
        R_Mesh_VertexPointer(skysphere_vertex3f, 0, 0);
        R_Mesh_ColorPointer(NULL, 0, 0);