From 50099d9c0934fe93646fa2792fa7a9657422333b Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 27 May 2007 06:46:44 +0000 Subject: [PATCH] added polygonoffset as a texture property, used on submodels (such as 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 --- cl_particles.c | 1 + cl_screen.c | 1 + gl_backend.c | 14 ++++++++++++++ gl_backend.h | 1 + gl_draw.c | 2 ++ gl_rmain.c | 33 +++++++++++++++++++++++++++++---- gl_rsurf.c | 1 + model_shared.h | 4 ++++ r_explosion.c | 1 + r_lightning.c | 1 + r_shadow.c | 10 ++++++---- r_sky.c | 2 ++ 12 files changed, 63 insertions(+), 8 deletions(-) diff --git a/cl_particles.c b/cl_particles.c index 3d9523e8..06716148 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -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 diff --git a/cl_screen.c b/cl_screen.c index 7f53840b..6599c20f 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -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); diff --git a/gl_backend.c b/gl_backend.c index 4dbdc8ce..f4c81f63 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -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) diff --git a/gl_backend.h b/gl_backend.h index 088cdb32..a8c2c3bf 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -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); diff --git a/gl_draw.c b/gl_draw.c index 251009ef..2f4367c1 100644 --- 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) { diff --git a/gl_rmain.c b/gl_rmain.c index 2d989ca1..a0bd2808 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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); diff --git a/gl_rsurf.c b/gl_rsurf.c index 6f77b47f..db9cc545 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -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); diff --git a/model_shared.h b/model_shared.h index 1ce9f2e5..58f15c82 100644 --- a/model_shared.h +++ b/model_shared.h @@ -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; diff --git a/r_explosion.c b/r_explosion.c index f73e5cc9..48ce2ef3 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -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); diff --git a/r_lightning.c b/r_lightning.c index 76c8ff24..c8ff41f4 100644 --- a/r_lightning.c +++ b/r_lightning.c @@ -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(); diff --git a/r_shadow.c b/r_shadow.c index 377acc5d..aa67549c 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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 e7e5b30b..51caa6ce 100644 --- 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); -- 2.39.2