comparison pytouhou/ui/background.pyx @ 449:d56536ef28e8

Improve render_elements’ speed a lot, and fix it in some corner cases. Thanks liori!
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 03 Aug 2013 15:49:11 +0200
parents 878273a984c4
children 6e733ed817bd
comparison
equal deleted inserted replaced
448:3bc37791f0a2 449:d56536ef28e8
88 vertex_buffer[nb_vertices+2] = Vertex(x3 + ox + ox2, y3 + oy + oy2, z3 + oz + oz2, right, top, r, g, b, a) 88 vertex_buffer[nb_vertices+2] = Vertex(x3 + ox + ox2, y3 + oy + oy2, z3 + oz + oz2, right, top, r, g, b, a)
89 vertex_buffer[nb_vertices+3] = Vertex(x4 + ox + ox2, y4 + oy + oy2, z4 + oz + oz2, left, top, r, g, b, a) 89 vertex_buffer[nb_vertices+3] = Vertex(x4 + ox + ox2, y4 + oy + oy2, z4 + oz + oz2, left, top, r, g, b, a)
90 90
91 nb_vertices += 4 91 nb_vertices += 4
92 92
93 self.texture, self.blendfunc = key 93 self.texture = key % MAX_TEXTURES
94 self.blendfunc = key // MAX_TEXTURES
94 self.nb_vertices = nb_vertices 95 self.nb_vertices = nb_vertices
95 self.vertex_buffer = <Vertex*> realloc(vertex_buffer, nb_vertices * sizeof(Vertex)) 96 self.vertex_buffer = <Vertex*> realloc(vertex_buffer, nb_vertices * sizeof(Vertex))
96 97
97 if not self.use_fixed_pipeline: 98 if not self.use_fixed_pipeline:
98 glBindBuffer(GL_ARRAY_BUFFER, self.vbo) 99 glBindBuffer(GL_ARRAY_BUFFER, self.vbo)