comparison pytouhou/ui/opengl/renderer.pyx @ 587:6c9d8a3d853f

Use ARB_framebuffer_blit instead of a second rendering pass for scaled rendering, if supported, and remove framebuffer stuff from the Renderer.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 08 Oct 2014 18:34:27 +0200
parents 4b0593da29d5
children e15672733c93
comparison
equal deleted inserted replaced
586:4b0593da29d5 587:6c9d8a3d853f
20 (glVertexPointer, glTexCoordPointer, glColorPointer, 20 (glVertexPointer, glTexCoordPointer, glColorPointer,
21 glVertexAttribPointer, glEnableVertexAttribArray, glBlendFunc, 21 glVertexAttribPointer, glEnableVertexAttribArray, glBlendFunc,
22 glBindTexture, glDrawElements, glBindBuffer, glBufferData, 22 glBindTexture, glDrawElements, glBindBuffer, glBufferData,
23 GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, GL_UNSIGNED_BYTE, 23 GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, GL_UNSIGNED_BYTE,
24 GL_UNSIGNED_SHORT, GL_SHORT, GL_FLOAT, GL_SRC_ALPHA, 24 GL_UNSIGNED_SHORT, GL_SHORT, GL_FLOAT, GL_SRC_ALPHA,
25 GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO, GL_TEXTURE_2D, GL_TRIANGLES, 25 GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_TEXTURE_2D, GL_TRIANGLES,
26 GL_TRIANGLE_STRIP, glGenBuffers, glBindFramebuffer, glViewport, 26 GL_TRIANGLE_STRIP, glGenBuffers, glDeleteBuffers,
27 glDeleteBuffers, GL_FRAMEBUFFER, glClear, GL_COLOR_BUFFER_BIT, 27 GLuint, glDeleteTextures, glGenVertexArrays, glDeleteVertexArrays,
28 GL_DEPTH_BUFFER_BIT, GLuint, glDeleteTextures, glGenVertexArrays, 28 glBindVertexArray, glPushDebugGroup, GL_DEBUG_SOURCE_APPLICATION,
29 glDeleteVertexArrays, glBindVertexArray, glPushDebugGroup, 29 glPopDebugGroup)
30 GL_DEBUG_SOURCE_APPLICATION, glPopDebugGroup)
31 30
32 from pytouhou.lib.sdl import SDLError 31 from pytouhou.lib.sdl import SDLError
33 32
34 from pytouhou.game.element cimport Element 33 from pytouhou.game.element cimport Element
35 from .sprite cimport get_sprite_rendering_data 34 from .sprite cimport get_sprite_rendering_data
266 glBindTexture(GL_TEXTURE_2D, texture) 265 glBindTexture(GL_TEXTURE_2D, texture)
267 glDrawElements(GL_TRIANGLES, 6 * length, GL_UNSIGNED_SHORT, indices) 266 glDrawElements(GL_TRIANGLES, 6 * length, GL_UNSIGNED_SHORT, indices)
268 267
269 if use_debug_group: 268 if use_debug_group:
270 glPopDebugGroup() 269 glPopDebugGroup()
271
272
273 cdef void render_framebuffer(self, Framebuffer fb):
274 assert not is_legacy
275
276 if use_debug_group:
277 glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Framebuffer drawing")
278
279 glBindFramebuffer(GL_FRAMEBUFFER, 0)
280 glViewport(self.x, self.y, self.width, self.height)
281 glBlendFunc(GL_ONE, GL_ZERO)
282 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
283
284 fb.render()
285
286 if use_debug_group:
287 glPopDebugGroup()