picogl.renderer.draw_spec
CPU-side draw layout and draw specifications for MeshData.
These types describe what portion of a mesh to draw. They contain no OpenGL
objects. A VAO/VBG consumes a MeshDrawSpec to issue glDraw*.
Attributes
Classes
Persistent topology for a mesh (how items map onto vertices/indices). |
|
One GL-free draw: mode, element/vertex count, and EBO byte offset. |
Functions
|
Infer a conservative layout when the mesh has no explicit |
|
Map a logical item range onto a |
|
Issue |
Module Contents
- class picogl.renderer.draw_spec.MeshDrawInfo[source]
Persistent topology for a mesh (how items map onto vertices/indices).
- Parameters:
mode – Primitive mode (
POINTS,LINES,TRIANGLES, …).indexed – Whether drawing uses an element buffer.
elements_per_item – Indices per logical item (atom, bond, …), or
Nonewhen the mesh is not instanced.vertices_per_item – Vertices per logical item, used when expanding per-item attributes such as colors.
- class picogl.renderer.draw_spec.MeshDrawSpec[source]
One GL-free draw: mode, element/vertex count, and EBO byte offset.
- Parameters:
mode – Primitive mode for
glDrawArrays/glDrawElements.count – Vertex count (non-indexed) or index count (indexed).
first – First vertex for non-indexed draws.
pointer – Byte offset into the element buffer for indexed draws.
- to_draw_spec() picogl.backend.modern.core.vertex.array.draw_spec.DrawSpec[source]
Convert to the GPU
DrawSpec.
- picogl.renderer.draw_spec.infer_draw_info(*, has_indices: bool, index_count: int = 0) MeshDrawInfo[source]
Infer a conservative layout when the mesh has no explicit
draw_info.Indexed meshes default to triangles; otherwise points. Line-stick bond meshes must set
MeshDrawInfoexplicitly (LINES).
- picogl.renderer.draw_spec.compute_draw_spec(info: MeshDrawInfo, *, index_count: int = 0, vertex_count: int = 0, first_item: int = 0, item_count: int | None = None) MeshDrawSpec[source]
Map a logical item range onto a
MeshDrawSpec.- Parameters:
info – Mesh topology.
index_count – Length of the element buffer (0 if none).
vertex_count – Number of vertices.
first_item – First logical item (atom, bond, …).
item_count – Number of items;
Nonedraws the remainder.
- Returns:
Draw specification with counts clamped to the buffer.
- picogl.renderer.draw_spec.execute_draw_spec(vao: Any, spec: MeshDrawSpec) None[source]
Issue
VertexArrayObject.drawfrom a resolvedMeshDrawSpec.- Parameters:
vao – GPU vertex array that implements
draw(...).spec – Count/mode/offset for one
glDraw*call.