# HG changeset patch # User Emmanuel Gil Peyrot # Date 1419181823 -3600 # Node ID 23b9418e4b2f54b3cb423ea0ef0bc98fcdf17428 # Parent 725bd24235a245d0e7c7356a1a89e2e662bb3fc0 Remove generic usage of GL_DRAW_FRAMEBUFFER which was introduced in GL 3.0 with framebuffer_blit. diff --git a/pytouhou/lib/opengl.pxd b/pytouhou/lib/opengl.pxd --- a/pytouhou/lib/opengl.pxd +++ b/pytouhou/lib/opengl.pxd @@ -104,7 +104,7 @@ cdef extern from 'epoxy/gl.h' nogil: ctypedef enum GLenum_framebuffer 'GLenum': GL_FRAMEBUFFER - GL_DRAW_FRAMEBUFFER + GL_READ_FRAMEBUFFER ctypedef enum GLenum_renderbuffer 'GLenum': GL_RENDERBUFFER diff --git a/pytouhou/ui/opengl/backend.pyx b/pytouhou/ui/opengl/backend.pyx --- a/pytouhou/ui/opengl/backend.pyx +++ b/pytouhou/ui/opengl/backend.pyx @@ -91,7 +91,7 @@ def create_window(title, x, y, width, he 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) diff --git a/pytouhou/ui/opengl/framebuffer.pyx b/pytouhou/ui/opengl/framebuffer.pyx --- 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)