- class arcade.gl.Buffer(ctx: Context, data: Optional[Any] = None, reserve: int = 0, usage: str = 'static')[source]#
OpenGL buffer object. Buffers store byte data and upload it to graphics memory so shader programs can process the data. They are used for storage of vertex data, element data (vertex indexing), uniform block data etc.
Buffer objects should be created using
- property ctx: Context#
The context this resource belongs to.
- property glo: ctypes.c_uint#
The OpenGL resource id
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]#
Release/delete open gl buffer. This is automatically called when the object is garbage collected.
- read(size: int = - 1, offset: int = 0) bytes [source]#
Read data from the buffer.
- write(data: Any, offset: int = 0)[source]#
Write byte data to the buffer.
- copy_from_buffer(source: arcade.gl.buffer.Buffer, size=- 1, offset=0, source_offset=0)[source]#
Copy data into this buffer from another buffer
- orphan(size: int = - 1, double: bool = False)[source]#
Re-allocate the entire buffer memory. This can be used to resize a buffer or for re-specification (orphan the buffer to avoid blocking).
If the current buffer is busy in rendering operations it will be deallocated by OpenGL when completed.
- bind_to_uniform_block(binding: int = 0, offset: int = 0, size: int = - 1)[source]#
Bind this buffer to a uniform block location. In most cases it will be sufficient to only provide a binding location.