Mercurial > touhou
comparison 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 |
comparison
equal
deleted
inserted
replaced
608:725bd24235a2 | 609:23b9418e4b2f |
---|---|
25 GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_COMPLETE, glGenBuffers, | 25 GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_COMPLETE, glGenBuffers, |
26 glDeleteBuffers, glBindBuffer, glBufferData, GL_ARRAY_BUFFER, | 26 glDeleteBuffers, glBindBuffer, glBufferData, GL_ARRAY_BUFFER, |
27 GL_STATIC_DRAW, glGenVertexArrays, glDeleteVertexArrays, | 27 GL_STATIC_DRAW, glGenVertexArrays, glDeleteVertexArrays, |
28 glBindVertexArray, glVertexAttribPointer, GL_SHORT, GL_FLOAT, | 28 glBindVertexArray, glVertexAttribPointer, GL_SHORT, GL_FLOAT, |
29 glEnableVertexAttribArray, glDrawArrays, GL_TRIANGLE_STRIP, | 29 glEnableVertexAttribArray, glDrawArrays, GL_TRIANGLE_STRIP, |
30 glBlitFramebuffer, GL_DRAW_FRAMEBUFFER, glClear, GL_COLOR_BUFFER_BIT, | 30 glBlitFramebuffer, GL_READ_FRAMEBUFFER, glClear, GL_COLOR_BUFFER_BIT, |
31 GL_DEPTH_BUFFER_BIT, glViewport, glBlendFunc, GL_ONE, GL_ZERO) | 31 GL_DEPTH_BUFFER_BIT, glViewport, glBlendFunc, GL_ONE, GL_ZERO) |
32 | 32 |
33 from .backend cimport use_debug_group, use_vao, use_framebuffer_blit | 33 from .backend cimport use_debug_group, use_vao, use_framebuffer_blit |
34 | 34 |
35 cdef class Framebuffer: | 35 cdef class Framebuffer: |
116 | 116 |
117 cdef void render(self, int x, int y, int width, int height) nogil: | 117 cdef void render(self, int x, int y, int width, int height) nogil: |
118 if use_debug_group: | 118 if use_debug_group: |
119 glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Framebuffer drawing") | 119 glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Framebuffer drawing") |
120 | 120 |
121 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0) | 121 glBindFramebuffer(GL_FRAMEBUFFER, 0) |
122 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) | 122 glClear(GL_COLOR_BUFFER_BIT) |
123 | 123 |
124 if use_framebuffer_blit: | 124 if use_framebuffer_blit: |
125 glBindFramebuffer(GL_READ_FRAMEBUFFER, self.fbo) | |
125 glBlitFramebuffer(self.x, self.y, self.width, self.height, | 126 glBlitFramebuffer(self.x, self.y, self.width, self.height, |
126 x, y, x + width, y + height, | 127 x, y, x + width, y + height, |
127 GL_COLOR_BUFFER_BIT, GL_LINEAR) | 128 GL_COLOR_BUFFER_BIT, GL_LINEAR) |
128 else: | 129 else: |
129 glViewport(x, y, width, height) | 130 glViewport(x, y, width, height) |