comparison pytouhou/ui/opengl/background.pyx @ 515:b3193b43a86c

Add an indirection layer for textures, to cope with drivers assigning them random names.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 06 Dec 2013 19:02:42 +0100
parents 5e3e0b09a531
children b18f0bd30ad0
comparison
equal deleted inserted replaced
514:3d4410de78e1 515:b3193b43a86c
66 66
67 if not self.use_fixed_pipeline: 67 if not self.use_fixed_pipeline:
68 glBindBuffer(GL_ARRAY_BUFFER, 0) 68 glBindBuffer(GL_ARRAY_BUFFER, 0)
69 69
70 70
71 cdef void load(self, background): 71 cdef void load(self, background, Renderer renderer):
72 cdef float ox, oy, oz, ox2, oy2, oz2 72 cdef float ox, oy, oz, ox2, oy2, oz2
73 cdef unsigned short nb_vertices = 0 73 cdef unsigned short nb_vertices = 0
74 cdef Vertex* vertex_buffer 74 cdef Vertex* vertex_buffer
75 75
76 self.background = background 76 self.background = background
90 vertex_buffer[nb_vertices+2] = Vertex(x3 + ox + ox2, y3 + oy + oy2, z3 + oz + oz2, right, top, r, g, b, a) 90 vertex_buffer[nb_vertices+2] = Vertex(x3 + ox + ox2, y3 + oy + oy2, z3 + oz + oz2, right, top, r, g, b, a)
91 vertex_buffer[nb_vertices+3] = Vertex(x4 + ox + ox2, y4 + oy + oy2, z4 + oz + oz2, left, top, r, g, b, a) 91 vertex_buffer[nb_vertices+3] = Vertex(x4 + ox + ox2, y4 + oy + oy2, z4 + oz + oz2, left, top, r, g, b, a)
92 92
93 nb_vertices += 4 93 nb_vertices += 4
94 94
95 self.texture = key >> 1 95 self.texture = renderer.textures[key >> 1]
96 self.blendfunc = key & 1 96 self.blendfunc = key & 1
97 self.nb_vertices = nb_vertices 97 self.nb_vertices = nb_vertices
98 self.vertex_buffer = <Vertex*> realloc(vertex_buffer, nb_vertices * sizeof(Vertex)) 98 self.vertex_buffer = <Vertex*> realloc(vertex_buffer, nb_vertices * sizeof(Vertex))
99 99
100 if not self.use_fixed_pipeline: 100 if not self.use_fixed_pipeline: