comparison pytouhou/ui/renderer.pyx @ 464:36bc577b2392

Make the window resizable, and scale its content correctly.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 11 Sep 2013 15:55:19 +0200
parents a71b912b45b7
children feecdb4a8928
comparison
equal deleted inserted replaced
463:11708a1d0a1a 464:36bc577b2392
215 215
216 if not self.use_fixed_pipeline: 216 if not self.use_fixed_pipeline:
217 glBindBuffer(GL_ARRAY_BUFFER, 0) 217 glBindBuffer(GL_ARRAY_BUFFER, 0)
218 218
219 219
220 cpdef render_framebuffer(self, Framebuffer fb): 220 cpdef render_framebuffer(self, Framebuffer fb, Window window):
221 cdef PassthroughVertex[4] buf 221 cdef PassthroughVertex[4] buf
222 cdef unsigned short indices[6] 222 cdef unsigned short indices[6]
223 indices[:] = [0, 1, 2, 2, 3, 0] 223 indices[:] = [0, 1, 2, 2, 3, 0]
224 224
225 assert not self.use_fixed_pipeline 225 assert not self.use_fixed_pipeline
226 226
227 glBindFramebuffer(GL_FRAMEBUFFER, 0) 227 glBindFramebuffer(GL_FRAMEBUFFER, 0)
228 glViewport(0, 0, 640, 480) 228 glViewport(window.x, window.y, window.width, window.height)
229 glBlendFunc(GL_ONE, GL_ZERO) 229 glBlendFunc(GL_ONE, GL_ZERO)
230 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) 230 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
231 231
232 glBindBuffer(GL_ARRAY_BUFFER, self.framebuffer_vbo) 232 glBindBuffer(GL_ARRAY_BUFFER, self.framebuffer_vbo)
233 233