diff pytouhou/ui/opengl/framebuffer.pyx @ 609:23b9418e4b2f

Remove generic usage of GL_DRAW_FRAMEBUFFER which was introduced in GL 3.0 with framebuffer_blit.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 21 Dec 2014 18:10:23 +0100
parents 6c9d8a3d853f
children 1b31169dc344
line wrap: on
line diff
--- a/pytouhou/ui/opengl/framebuffer.pyx
+++ b/pytouhou/ui/opengl/framebuffer.pyx
@@ -27,7 +27,7 @@ from pytouhou.lib.opengl cimport \
           GL_STATIC_DRAW, glGenVertexArrays, glDeleteVertexArrays,
           glBindVertexArray, glVertexAttribPointer, GL_SHORT, GL_FLOAT,
           glEnableVertexAttribArray, glDrawArrays, GL_TRIANGLE_STRIP,
-          glBlitFramebuffer, GL_DRAW_FRAMEBUFFER, glClear, GL_COLOR_BUFFER_BIT,
+          glBlitFramebuffer, GL_READ_FRAMEBUFFER, glClear, GL_COLOR_BUFFER_BIT,
           GL_DEPTH_BUFFER_BIT, glViewport, glBlendFunc, GL_ONE, GL_ZERO)
 
 from .backend cimport use_debug_group, use_vao, use_framebuffer_blit
@@ -118,10 +118,11 @@ cdef class Framebuffer:
         if use_debug_group:
             glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Framebuffer drawing")
 
-        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
-        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+        glBindFramebuffer(GL_FRAMEBUFFER, 0)
+        glClear(GL_COLOR_BUFFER_BIT)
 
         if use_framebuffer_blit:
+            glBindFramebuffer(GL_READ_FRAMEBUFFER, self.fbo)
             glBlitFramebuffer(self.x, self.y, self.width, self.height,
                               x, y, x + width, y + height,
                               GL_COLOR_BUFFER_BIT, GL_LINEAR)