comparison pytouhou/ui/opengl/renderer.pxd @ 627:ec972eb44391

Use a specific vbo/vao pair for text rendering.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 05 Mar 2015 20:36:41 +0100
parents a6af3ff86612
children
comparison
equal deleted inserted replaced
626:13789ac717c4 627:ec972eb44391
3 from .texture cimport TextureManager, FontManager 3 from .texture cimport TextureManager, FontManager
4 from .framebuffer cimport Framebuffer 4 from .framebuffer cimport Framebuffer
5 5
6 cdef struct Vertex: 6 cdef struct Vertex:
7 short x, y, z, padding 7 short x, y, z, padding
8 float u, v
9 unsigned char r, g, b, a
10
11
12 cdef struct TextVertex:
13 short x, y
8 float u, v 14 float u, v
9 unsigned char r, g, b, a 15 unsigned char r, g, b, a
10 16
11 17
12 cdef class Texture: 18 cdef class Texture:
24 cdef FontManager font_manager 30 cdef FontManager font_manager
25 cdef Vertex vertex_buffer[MAX_ELEMENTS] 31 cdef Vertex vertex_buffer[MAX_ELEMENTS]
26 cdef long x, y, width, height 32 cdef long x, y, width, height
27 33
28 # For modern GL. 34 # For modern GL.
29 cdef GLuint vbo 35 cdef GLuint vbo, text_vbo
30 cdef GLuint vao 36 cdef GLuint vao, text_vao
31 37
32 cdef GLuint textures[MAX_TEXTURES] 38 cdef GLuint textures[MAX_TEXTURES]
33 cdef unsigned short *indices[MAX_TEXTURES][2] 39 cdef unsigned short *indices[MAX_TEXTURES][2]
34 cdef unsigned short last_indices[2 * MAX_TEXTURES] 40 cdef unsigned short last_indices[2 * MAX_TEXTURES]
35 cdef PyObject *elements[640*3] 41 cdef PyObject *elements[640*3]
36 42
37 cdef void set_state(self) nogil 43 cdef void set_state(self) nogil
44 cdef void set_text_state(self) nogil
38 cdef bint render_elements(self, elements) except True 45 cdef bint render_elements(self, elements) except True
39 cdef bint render_quads(self, rects, colors, GLuint texture) except True 46 cdef bint render_quads(self, rects, colors, GLuint texture) except True