VAO¶
-
class
demosys.opengl.
VAO
(name, mode=4)¶ Represents a vertex array object. A name must be provided for debug puporses. The default draw mode is
moderngl.TRIANGLES
Methods¶
-
VAO.
buffer
(buffer, buffer_format:str, attribute_names, per_instance=False)¶ Register a buffer/vbo for the VAO. This can be called multiple times. adding multiple buffers (interleaved or not)
Parameters: - buffer – The buffer object. Can be ndarray or Buffer
- buffer_format – The format of the buffer (‘f’, ‘u’, ‘i’)
Returns: The buffer object
-
VAO.
index_buffer
(buffer, index_element_size=4)¶ Set the index buffer for this VAO
Parameters: - buffer – Buffer object or ndarray
- index_element_size – Byte size of each element. 1, 2 or 4
-
VAO.
subroutines
(shader, routines:tuple)¶ Set the active subroutines
-
VAO.
release
()¶ Destroy the vao object and its buffers
Draw Methods¶
-
VAO.
draw
(shader:ShaderProgram, mode=None, vertices=-1, first=0, instances=1)¶ Draw the VAO. Will use
glDrawElements
if an element buffer is present andglDrawArrays
if no element array is present.Parameters: - shader – The shader to draw with
- mode – Override the draw mode (GL_TRIANGLES etc)
- vertices – The number of vertices to transform
- first – The index of the first vertex to start with
- instances – The number of instances
-
VAO.
transform
(shader, buffer:Buffer, mode=None, vertices=-1, first=0, instances=1)¶ Transform vertices. Stores the output in a single buffer.
Parameters: - buffer – The buffer to store the output
- mode – Draw mode (for example POINTS
- vertices – The number of vertices to transform
- first – The index of the first vertex to start with
- instances – The number of instances
Returns: