From 52d4c3970e3241a60a61dc5c304f8f425d14d9e2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 22 Sep 2016 10:00:40 +0200 Subject: [PATCH] - use glPOlygonOffset on non-translucent flat and wall sprites to avoid z-fighting. --- src/gl/scene/gl_sprite.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 720df3b2b..123bf258c 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -310,6 +310,11 @@ void GLSprite::Draw(int pass) additivefog = true; } } + else if (modelframe == nullptr) + { + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(-1.0f, -128.0f); + } if (RenderStyle.BlendOp!=STYLEOP_Shadow) { if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && !fullbright) @@ -440,6 +445,11 @@ void GLSprite::Draw(int pass) gl_RenderState.BlendEquation(GL_FUNC_ADD); gl_RenderState.SetTextureMode(TM_MODULATE); } + else if (modelframe == nullptr) + { + glPolygonOffset(0.0f, 0.0f); + glDisable(GL_POLYGON_OFFSET_FILL); + } gl_RenderState.SetObjectColor(0xffffffff); gl_RenderState.EnableTexture(true);