Mercurial > touhou
comparison pytouhou/opengl/gamerenderer.pyx @ 148:6460814b68ea
Work around a bug in nouveau
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 04 Oct 2011 17:52:37 +0200 |
parents | 982b21222602 |
children | 4f46717390aa |
comparison
equal
deleted
inserted
replaced
147:a61c96265779 | 148:6460814b68ea |
---|---|
83 index = nb_vertices | 83 index = nb_vertices |
84 rec.extend((index, index + 1, index + 2, index + 3)) | 84 rec.extend((index, index + 1, index + 2, index + 3)) |
85 | 85 |
86 nb_vertices += 4 | 86 nb_vertices += 4 |
87 | 87 |
88 glVertexPointer(3, GL_FLOAT, 24, <long> &self.vertex_buffer[0].x) | 88 for (texture_key, blendfunc), indices in indices_by_texture.items(): |
89 glTexCoordPointer(2, GL_FLOAT, 24, <long> &self.vertex_buffer[0].u) | 89 glVertexPointer(3, GL_FLOAT, 24, <long> &self.vertex_buffer[0].x) |
90 glColorPointer(4, GL_UNSIGNED_BYTE, 24, <long> &self.vertex_buffer[0].r) | 90 glTexCoordPointer(2, GL_FLOAT, 24, <long> &self.vertex_buffer[0].u) |
91 glColorPointer(4, GL_UNSIGNED_BYTE, 24, <long> &self.vertex_buffer[0].r) | |
91 | 92 |
92 for (texture_key, blendfunc), indices in indices_by_texture.items(): | |
93 nb_indices = len(indices) | 93 nb_indices = len(indices) |
94 indices = struct.pack(str(nb_indices) + 'H', *indices) | 94 indices = struct.pack(str(nb_indices) + 'H', *indices) |
95 glBlendFunc(GL_SRC_ALPHA, (GL_ONE_MINUS_SRC_ALPHA, GL_ONE)[blendfunc]) | 95 glBlendFunc(GL_SRC_ALPHA, (GL_ONE_MINUS_SRC_ALPHA, GL_ONE)[blendfunc]) |
96 glBindTexture(GL_TEXTURE_2D, self.texture_manager[texture_key].id) | 96 glBindTexture(GL_TEXTURE_2D, self.texture_manager[texture_key].id) |
97 glDrawElements(GL_QUADS, nb_indices, GL_UNSIGNED_SHORT, indices) | 97 glDrawElements(GL_QUADS, nb_indices, GL_UNSIGNED_SHORT, indices) |