annotate pytouhou/ui/opengl/framebuffer.pxd @ 772:7492d384d122 default tip

Rust: Add a Glide renderer (2D only for now) This is an experiment for a Rust renderer, iterating over the Python data using pyo3. It requires --feature=glide to be passed to cargo build, doesn’t support NPOT textures, text rendering, the background, or even msg faces, some of that may come in a future changeset.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 05 Sep 2022 17:53:36 +0200
parents a6af3ff86612
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
586
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 from pytouhou.lib.opengl cimport GLuint
610
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
2 from pytouhou.utils.matrix cimport Matrix
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
3 from .shader cimport Shader
586
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
5 cdef struct PassthroughVertex:
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
6 short x, y
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
7 float u, v
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
8
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
9
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
10 cdef class Framebuffer:
610
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
11 cdef GLuint fbo, texture, rbo
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
12
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
13 # Used by the use_framebuffer_blit path
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
14 cdef int x, y, width, height
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
15
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
16 # Used by the other one.
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
17 cdef GLuint vbo, vao
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
18 cdef Shader shader
1b31169dc344 Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 587
diff changeset
19 cdef Matrix *mvp
586
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
20 cdef PassthroughVertex[4] buf
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
21
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
22 cpdef bind(self)
4b0593da29d5 Simplify framebuffer rendering with glDrawArrays, and move it all to its own file.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
23 cdef void set_state(self) nogil
617
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 610
diff changeset
24 cdef bint render(self, int x, int y, int width, int height) except True