Mercurial > touhou
annotate pytouhou/ui/opengl/background.pxd @ 558:94725968dabb
Use vertex array objects, to be compatible with OpenGL 3.1+ core profile.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 12 Dec 2013 13:47:17 +0100 |
parents | b18f0bd30ad0 |
children | c759b97f4f81 |
rev | line source |
---|---|
519
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
1 from pytouhou.lib.opengl cimport GLuint, GLushort, GLsizei |
515
b3193b43a86c
Add an indirection layer for textures, to cope with drivers assigning them random names.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
513
diff
changeset
|
2 from .renderer cimport Renderer |
426
5d7bb2fd74f7
Never keep texture on the host when it has been uploaded, and prevent them from being decoded again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
3 |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 cdef struct Vertex: |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 float x, y, z |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 float u, v |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 unsigned char r, g, b, a |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 |
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 cdef class BackgroundRenderer: |
426
5d7bb2fd74f7
Never keep texture on the host when it has been uploaded, and prevent them from being decoded again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
423
diff
changeset
|
11 cdef GLuint texture |
519
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
12 cdef GLsizei nb_indices |
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
13 cdef unsigned int use_fixed_pipeline |
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
14 |
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
15 # For modern GL. |
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
16 cdef GLuint vbo, ibo |
558
94725968dabb
Use vertex array objects, to be compatible with OpenGL 3.1+ core profile.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
519
diff
changeset
|
17 cdef GLuint vao |
519
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
18 |
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
19 # For fixed pipeline. |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 cdef Vertex *vertex_buffer |
519
b18f0bd30ad0
Optimise background rendering.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
515
diff
changeset
|
21 cdef GLushort *indices |
423
d8630c086926
Replace Pyglet with our own Cython OpenGL wrapper.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 |
558
94725968dabb
Use vertex array objects, to be compatible with OpenGL 3.1+ core profile.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
519
diff
changeset
|
23 cdef void set_state(self) nogil |
468
feecdb4a8928
Add “except *” to cdef void functions, and type some more.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
459
diff
changeset
|
24 cdef void render_background(self) except * |
515
b3193b43a86c
Add an indirection layer for textures, to cope with drivers assigning them random names.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
513
diff
changeset
|
25 cdef void load(self, background, Renderer renderer) except * |