Fix depth buffer glitches
authorAndy Spencer <andy753421@gmail.com>
Wed, 23 May 2012 04:37:58 +0000 (04:37 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 23 May 2012 04:37:58 +0000 (04:37 +0000)
src/grits-opengl.c

index 1aec412..a2dce84 100644 (file)
@@ -307,11 +307,9 @@ static void _draw_level(gpointer _level, gpointer _opengl)
                /* Enable depth and alpha for world levels */
                glEnable(GL_ALPHA_TEST);
                glAlphaFunc(GL_GREATER, 0.1);
-               glDepthMask(TRUE);
        } else {
                /* Disable depth for Overlay/HUD levels */
-               // This causes rendering glitches not sure why..
-               //glDepthMask(FALSE);
+               glDepthMask(FALSE);
        }
 
        /* Start ortho */
@@ -341,6 +339,9 @@ static void _draw_level(gpointer _level, gpointer _opengl)
                glMatrixMode(GL_MODELVIEW);  glPopMatrix();
        }
 
+       /* Leave depth buffer write enabled */
+       glDepthMask(TRUE);
+
        /* TODO: Prune empty levels */
 
        g_debug("GritsOpenGL: _draw_level - drew %d,%d objects",