Geometry
Geometry Methods
- arcade.gl.geometry.quad_2d_fs() arcade.gl.vertex_array.Geometry [source]
Creates a screen aligned quad using normalized device coordinates
- arcade.gl.geometry.quad_2d(size: Tuple[float, float] = (1.0, 1.0), pos: Tuple[float, float] = (0.0, 0.0)) arcade.gl.vertex_array.Geometry [source]
Creates 2D quad Geometry using 2 triangle strip with texture coordinates.
- arcade.gl.geometry.screen_rectangle(bottom_left_x: float, bottom_left_y: float, width: float, height: float) arcade.gl.vertex_array.Geometry [source]
Creates screen rectangle using 2 triangle strip with texture coordinates.
Geometry
- class arcade.gl.Geometry(ctx: Context, content: Optional[Sequence[arcade.gl.types.BufferDescription]], index_buffer: arcade.gl.buffer.Buffer = None, mode=None, index_element_size: int = 4)[source]
Bases:
object
A higher level abstraction of the VertexArray. It generates VertexArray instances on the fly internally matching the incoming program. This means we can render the same geometry with different programs as long as the
Program
andBufferDescription
have compatible attributes.Geometry objects should be created through
arcade.gl.Context.geometry()
- Parameters
- property index_buffer: Optional[arcade.gl.buffer.Buffer]
Index/element buffer if supplied at creation.
- Type
- instance(program: arcade.gl.program.Program) arcade.gl.vertex_array.VertexArray [source]
Get the
arcade.gl.VertexArray
compatible with this program
- property num_vertices: int
Get or set the number of vertices. Be careful when modifying this properly and be absolutely sure what you are doing.
- Type
- render(program: arcade.gl.program.Program, *, mode: Optional[ctypes.c_uint] = None, first: int = 0, vertices: Optional[int] = None, instances: int = 1) None [source]
Render the geometry with a specific program.
- transform(program: arcade.gl.program.Program, buffer: arcade.gl.buffer.Buffer, *, first: int = 0, vertices: Optional[int] = None, instances: int = 1, buffer_offset: int = 0) None [source]
Render with transform feedback. Instead of rendering to the screen or a framebuffer the result will instead end up in the
buffer
we supply.If a geometry shader is used the output primitive mode is automatically detected.
- Parameters
program (Program) – The Program to render with
buffer (Buffer) – The buffer to write the output
mode (gl.GLenum) – The input primitive mode
first (int) – Offset start vertex
vertices (int) – Number of vertices to render
instances (int) – Number of instances to render
buffer_offset (int) – Byte offset for the buffer
VertexArray
- class arcade.gl.VertexArray(ctx: Context, program: arcade.gl.program.Program, content: Sequence[arcade.gl.types.BufferDescription], index_buffer: arcade.gl.buffer.Buffer = None, index_element_size: int = 4)[source]
Bases:
object
Wrapper for Vertex Array Objects (VAOs). This objects should not be instantiated from user code. Use
arcade.gl.Geometry
instead. It will create VAO instances for you automatically. There is a lot of complex interaction between programs and vertex arrays that will be done for you automatically.- delete()[source]
Destroy the underlying OpenGL resource. Don’t use this unless you know exactly what you are doing.
- static delete_glo(ctx: Context, glo: ctypes.c_uint)[source]
Delete this object. This is automatically called when this object is garbage collected.
- glo
- property ibo: Optional[arcade.gl.buffer.Buffer]
Element/index buffer
- Type
- property program: arcade.gl.program.Program
The assigned program
- Type
- render(mode: ctypes.c_uint, first: int = 0, vertices: int = 0, instances: int = 1)[source]
Render the VertexArray to the currently active framebuffer.
- transform(buffer: arcade.gl.buffer.Buffer, mode: ctypes.c_uint, output_mode: ctypes.c_uint, first: int = 0, vertices: int = 0, instances: int = 1, buffer_offset=0)[source]
Run a transform feedback.
- Parameters
buffer (Buffer) – The buffer to write the output
mode (gl.GLenum) – The input primitive mode
output:mode (gl.GLenum) – The output primitive mode
first (int) – Offset start vertex
vertices (int) – Number of vertices to render
instances (int) – Number of instances to render
buffer_offset (int) – Byte offset for the buffer (target)