picogl.protocols.drawable_buffer

OpenGL buffer protocols for ElMo.

Defines a shared interface (DrawableBuffer) for buffer/VAO objects used in legacy and modern backends, so group-level and draw code can treat them uniformly.

Attributes

DrawableLengthInput

Classes

DrawableBuffer

Protocol for OpenGL buffer/VAO objects that can be bound, drawn, and deleted.

MeshDrawable

GPU object that owns or delegates one CPU mesh.

VertexBufferDataSource

Single legacy/modern VBO or EBO with CPU-side data.

BufferContainer

Wrapper or group holding nested VAO/VBO handles (e.g. ElMo buffer groups).

Module Contents

class picogl.protocols.drawable_buffer.DrawableBuffer[source]

Bases: Protocol

Protocol for OpenGL buffer/VAO objects that can be bound, drawn, and deleted.

Implementors must provide bind(), unbind(), draw(), and delete(). Optional: is_valid() for validity checks; __enter__/__exit__ for context-manager support (with obj: obj.draw()).

Legacy VBO groups and modern VAOs (VertexArrayObject, RibbonVBG, etc.) conform to this protocol.

bind() → None[source]

Bind this buffer/VAO for rendering.

unbind() → None[source]

Unbind this buffer/VAO after rendering.

draw(*args: Any, **kwargs: Any) → None[source]

Issue draw calls. Signature is backend-specific (e.g. atom_count, index_count).

delete() → None[source]

Release GPU resources.

data_length() → int[source]

Number of vertices (or drawable elements) in this buffer.

class picogl.protocols.drawable_buffer.MeshDrawable[source]

Bases: Protocol

GPU object that owns or delegates one CPU mesh.

The mesh value is always MeshData. Lookup helpers use isinstance(..., MeshData); this protocol does not replace that check. Only mesh_data is part of the protocol. Draw and color upload stay on DrawableBuffer and the layout color helpers.

property mesh_data: picogl.renderer.meshdata.MeshData | None[source]

Attached MeshData, or None.

class picogl.protocols.drawable_buffer.VertexBufferDataSource[source]

Bases: Protocol

Single legacy/modern VBO or EBO with CPU-side data.

data: numpy.ndarray | None[source]
class picogl.protocols.drawable_buffer.BufferContainer[source]

Bases: Protocol

Wrapper or group holding nested VAO/VBO handles (e.g. ElMo buffer groups).

vao: DrawableBuffer | int | None[source]
vbo: VertexBufferDataSource | int | None[source]
named_vbos: Mapping[Any, VertexBufferDataSource][source]
index_count: int[source]
type picogl.protocols.drawable_buffer.DrawableLengthInput = DrawableBuffer | BufferContainer | VertexBufferDataSource | None[source]