changeset 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 725bd24235a2
children 1b31169dc344
files pytouhou/lib/opengl.pxd pytouhou/ui/opengl/backend.pyx pytouhou/ui/opengl/framebuffer.pyx
diffstat 3 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/lib/opengl.pxd	Wed Nov 26 14:00:17 2014 +0100
+++ b/pytouhou/lib/opengl.pxd	Sun Dec 21 18:10:23 2014 +0100
@@ -104,7 +104,7 @@
 
     ctypedef enum GLenum_framebuffer 'GLenum':
         GL_FRAMEBUFFER
-        GL_DRAW_FRAMEBUFFER
+        GL_READ_FRAMEBUFFER
 
     ctypedef enum GLenum_renderbuffer 'GLenum':
         GL_RENDERBUFFER
--- a/pytouhou/ui/opengl/backend.pyx	Wed Nov 26 14:00:17 2014 +0100
+++ b/pytouhou/ui/opengl/backend.pyx	Sun Dec 21 18:10:23 2014 +0100
@@ -91,7 +91,7 @@
     sdl.gl_set_attribute(sdl.GL_CONTEXT_PROFILE_MASK, profile)
     sdl.gl_set_attribute(sdl.GL_CONTEXT_MAJOR_VERSION, major)
     sdl.gl_set_attribute(sdl.GL_CONTEXT_MINOR_VERSION, minor)
-    sdl.gl_set_attribute(sdl.GL_DEPTH_SIZE, 24)
+    sdl.gl_set_attribute(sdl.GL_DEPTH_SIZE, 24 if is_legacy else 0)
     if double_buffer >= 0:
         sdl.gl_set_attribute(sdl.GL_DOUBLEBUFFER, double_buffer)
 
--- a/pytouhou/ui/opengl/framebuffer.pyx	Wed Nov 26 14:00:17 2014 +0100
+++ b/pytouhou/ui/opengl/framebuffer.pyx	Sun Dec 21 18:10:23 2014 +0100
@@ -27,7 +27,7 @@
           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 @@
         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)