changeset 427:0604f4fbbe3c

Move the depth buffer clear outside of scissor, as per apitrace’s advice.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 03 Aug 2013 15:48:51 +0200
parents 5d7bb2fd74f7
children f41a26971a19
files pytouhou/ui/gamerenderer.pyx pytouhou/ui/gamerunner.pyx
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/ui/gamerenderer.pyx
+++ b/pytouhou/ui/gamerenderer.pyx
@@ -17,7 +17,7 @@ from itertools import chain
 
 from pytouhou.lib.opengl cimport \
          (glClear, glMatrixMode, glLoadIdentity, glLoadMatrixf, glDisable,
-          glEnable, glFogi, glFogf, glFogfv, GL_DEPTH_BUFFER_BIT,
+          glEnable, glFogi, glFogf, glFogfv,
           GL_PROJECTION, GL_MODELVIEW, GL_FOG, GL_FOG_MODE, GL_LINEAR,
           GL_FOG_START, GL_FOG_END, GL_FOG_COLOR, GL_COLOR_BUFFER_BIT, GLfloat)
 
@@ -36,8 +36,6 @@ class GameRenderer(Renderer):
     def render(self):
         cdef float* fog_data
 
-        glClear(GL_DEPTH_BUFFER_BIT)
-
         back = self.background
         game = self.game
 
--- a/pytouhou/ui/gamerunner.pyx
+++ b/pytouhou/ui/gamerunner.pyx
@@ -17,7 +17,7 @@ from pytouhou.lib import sdl
 from pytouhou.lib.opengl cimport \
          (glMatrixMode, glEnable, glDisable, glViewport, glScissor,
           glLoadMatrixf, glGenBuffers, glDeleteBuffers, GL_MODELVIEW,
-          GL_FOG, GL_SCISSOR_TEST)
+          GL_FOG, GL_SCISSOR_TEST, glClear, GL_DEPTH_BUFFER_BIT)
 
 from pytouhou.utils.helpers import get_logger
 from pytouhou.utils.maths cimport perspective, setup_camera, ortho_2d
@@ -162,6 +162,7 @@ class GameRunner(GameRenderer):
         #TODO: move that to GameRenderer?
         x, y = self.game.interface.game_pos
         glViewport(x, y, self.game.width, self.game.height)
+        glClear(GL_DEPTH_BUFFER_BIT)
         glScissor(x, y, self.game.width, self.game.height)
         glEnable(GL_SCISSOR_TEST)