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:
R_Mesh_ColorPointer(particle_color4f, 0, 0);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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
GL_DepthTest(true);
GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
GL_Color(1,1,1,1);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthRange(0, 1);
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);
GL_DepthTest(false);
R_Mesh_VertexPointer(vertex3f, 0, 0);
R_Mesh_ColorPointer(NULL, 0, 0);
int colormask; // stored as bottom 4 bits: r g b a (3 2 1 0 order)
int depthtest;
float depthrange[2];
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;
int alphatest;
int scissortest;
unsigned int unit;
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.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;
qglDepthFunc(GL_LEQUAL);CHECKGLERROR
qglEnable(GL_DEPTH_TEST);CHECKGLERROR
qglDepthMask(gl_state.depthmask);CHECKGLERROR
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)
{
if (gl_support_arb_vertex_buffer_object)
{
+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)
void GL_SetMirrorState(qboolean state)
{
if(!state != !v_flipped_state)
void GL_DepthMask(int state);
void GL_DepthTest(int state);
void GL_DepthRange(float nearfrac, float farfrac);
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);
void GL_CullFace(int state);
void GL_AlphaTest(int state);
void GL_ColorMask(int r, int g, int b, int a);
GL_DepthMask(true);
GL_DepthRange(0, 1);
GL_DepthMask(true);
GL_DepthRange(0, 1);
+ GL_PolygonOffset(0, 0);
GL_DepthTest(false);
GL_Color(1,1,1,1);
GL_AlphaTest(false);
GL_DepthTest(false);
GL_Color(1,1,1,1);
GL_AlphaTest(false);
R_Mesh_ResetTextureState();
GL_DepthMask(true);
GL_DepthRange(0, 1);
R_Mesh_ResetTextureState();
GL_DepthMask(true);
GL_DepthRange(0, 1);
+ GL_PolygonOffset(0, 0);
GL_DepthTest(false);
if (v_color_enable.integer)
{
GL_DepthTest(false);
if (v_color_enable.integer)
{
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_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)"};
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)"};
Cvar_RegisterVariable(&r_shadows);
Cvar_RegisterVariable(&r_shadows_throwdistance);
Cvar_RegisterVariable(&r_q1bsp_skymasking);
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);
Cvar_RegisterVariable(&r_textureunits);
Cvar_RegisterVariable(&r_glsl);
Cvar_RegisterVariable(&r_glsl_offsetmapping);
GL_DepthTest(false);
R_Mesh_Matrix(&identitymatrix);
R_Mesh_ResetTextureState();
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
qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR
qglDepthFunc(GL_LEQUAL);CHECKGLERROR
qglDisable(GL_STENCIL_TEST);CHECKGLERROR
GL_DepthTest(true);
R_Mesh_Matrix(&identitymatrix);
R_Mesh_ResetTextureState();
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
qglEnable(GL_POLYGON_OFFSET_FILL);CHECKGLERROR
qglDepthFunc(GL_LEQUAL);CHECKGLERROR
qglDisable(GL_STENCIL_TEST);CHECKGLERROR
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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();
R_Mesh_Matrix(&identitymatrix);
R_Mesh_ResetTextureState();
GL_DepthMask(true);
}
GL_DepthRange(0, (ent->flags & RENDER_VIEWMODEL) ? 0.0625 : 1);
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);
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);
GL_DepthMask(false);
GL_DepthRange(0, depthshort ? 0.0625 : 1);
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;
GL_DepthTest(!depthdisable);
vertex3f[ 0] = origin[0] + left[0] * scalex2 + up[0] * scaley1;
t->specularscale = r_shadow_gloss2intensity.value;
}
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))
VectorClear(t->dlightcolor);
t->currentnumlayers = 0;
if (!(t->currentmaterialflags & MATERIALFLAG_NODRAW))
static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, msurface_t **texturesurfacelist)
{
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
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)
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)
R_Mesh_Matrix(&rsurface.matrix);
}
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
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);
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);
GL_Color(1,1,1,1);
}
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
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);
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);
if (rsurface.mode != RSURFMODE_MULTIPASS)
rsurface.mode = RSURFMODE_MULTIPASS;
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
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);
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);
if (!writedepth && (rsurface.texture->currentmaterialflags & (MATERIALFLAG_BLENDED | MATERIALFLAG_ALPHATEST)))
writedepth = true;
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
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);
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);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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);
GL_DepthTest(true);
GL_CullFace(GL_NONE);
R_Mesh_Matrix(&identitymatrix);
GL_DepthMask(false);
GL_DepthRange(0, 1);
GL_DepthTest(!r_showdisabledepthtest.integer);
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);
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)
}
void R_DrawTrianglesAndNormals(entity_render_t *ent, qboolean drawtris, qboolean drawnormals, int flagsmask)
CHECKGLERROR
GL_DepthRange(0, 1);
GL_DepthTest(!r_showdisabledepthtest.integer);
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);
GL_DepthMask(true);
GL_BlendFunc(GL_ONE, GL_ZERO);
R_Mesh_ColorPointer(NULL, 0, 0);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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);
GL_DepthTest(true);
GL_CullFace(GL_NONE);
R_Mesh_Matrix(&identitymatrix);
// current material flags (updated each bmodel render)
int currentmaterialflags;
// 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;
// textures to use when rendering this material
skinframe_t *currentskinframe;
int numskinframes;
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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);
GL_DepthTest(true);
GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
R_Mesh_Matrix(&identitymatrix);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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();
GL_DepthTest(true);
if (r_lightningbeam_qmbtexture.integer && r_lightningbeamqmbtexture == NULL)
r_lightningbeams_setupqmbtexture();
R_Mesh_ResetTextureState();
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthRange(0, 1);
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);
GL_DepthTest(true);
GL_DepthMask(false);
GL_Color(0, 0, 0, 1);
GL_DepthTest(true);
GL_DepthMask(false);
qglDepthFunc(GL_LEQUAL);CHECKGLERROR
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
qglDisable(GL_STENCIL_TEST);CHECKGLERROR
qglStencilMask(~0);CHECKGLERROR
qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);CHECKGLERROR
CHECKGLERROR
R_Shadow_RenderMode_Reset();
GL_ColorMask(0, 0, 0, 0);
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;
qglDepthFunc(GL_LESS);CHECKGLERROR
qglEnable(GL_STENCIL_TEST);CHECKGLERROR
r_shadow_rendermode = r_shadow_shadowingrendermode;
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);
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;
}
GL_CullFace(GL_NONE);
r_shadow_rendermode = R_SHADOW_RENDERMODE_VISIBLEVOLUMES;
}
if ((ambientscale + diffusescale) * VectorLength2(lightcolorbase) + specularscale * VectorLength2(lightcolorbase) < (1.0f / 1048576.0f))
return;
GL_DepthRange(0, (rsurface.texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) ? 0.0625 : 1);
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)
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)
GL_DepthRange(0, 1);
GL_DepthTest(false);
GL_DepthMask(false);
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
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
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(false);
GL_DepthRange(0, 1);
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);
GL_DepthTest(false); // don't modify or read zbuffer
R_Mesh_VertexPointer(skyboxvertex3f, 0, 0);
R_Mesh_ColorPointer(NULL, 0, 0);
GL_BlendFunc(GL_ONE, GL_ZERO);
GL_DepthMask(true);
GL_DepthRange(0, 1);
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);
GL_DepthTest(false); // don't modify or read zbuffer
R_Mesh_VertexPointer(skysphere_vertex3f, 0, 0);
R_Mesh_ColorPointer(NULL, 0, 0);