comparison pytouhou/ui/opengl/background.pyx @ 586:4b0593da29d5

Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 08 Oct 2014 16:34:24 +0200
parents e0166cda75d5
children 974decb8df4f
comparison
equal deleted inserted replaced
585:e0166cda75d5 586:4b0593da29d5
107 107
108 if use_debug_group: 108 if use_debug_group:
109 glPopDebugGroup() 109 glPopDebugGroup()
110 110
111 111
112 cdef void load(self, background, Renderer renderer): 112 cdef void load(self, background, GLuint[MAX_TEXTURES] textures):
113 cdef float ox, oy, oz, ox2, oy2, oz2 113 cdef float ox, oy, oz, ox2, oy2, oz2
114 cdef GLsizei nb_vertices = 0, nb_indices = 0 114 cdef GLsizei nb_vertices = 0, nb_indices = 0
115 115
116 vertex_buffer = <Vertex*> malloc(65536 * sizeof(Vertex)) 116 vertex_buffer = <Vertex*> malloc(65536 * sizeof(Vertex))
117 indices = <GLushort*> malloc(65536 * sizeof(GLushort)) 117 indices = <GLushort*> malloc(65536 * sizeof(GLushort))
151 151
152 # We only need to keep the rendered vertices and indices in memory, 152 # We only need to keep the rendered vertices and indices in memory,
153 # either in RAM or in VRAM, they will never change until we implement 153 # either in RAM or in VRAM, they will never change until we implement
154 # background animation. 154 # background animation.
155 155
156 self.texture = renderer.textures[key >> 1] 156 self.texture = textures[key >> 1]
157 self.nb_indices = nb_indices 157 self.nb_indices = nb_indices
158 158
159 if is_legacy: 159 if is_legacy:
160 self.vertex_buffer = <Vertex*> realloc(vertex_buffer, nb_vertices * sizeof(Vertex)) 160 self.vertex_buffer = <Vertex*> realloc(vertex_buffer, nb_vertices * sizeof(Vertex))
161 self.indices = <GLushort*> realloc(indices, nb_indices * sizeof(GLushort)) 161 self.indices = <GLushort*> realloc(indices, nb_indices * sizeof(GLushort))