picogl.renderer.legacy_glmesh

Module for creating and managing GPU-resident meshes in a legacy OpenGL compatibility profile.

This module defines the LegacyGLMesh class, which represents an indexed triangle mesh. It provides functionality for uploading mesh data to GPU buffers, managing their lifecycle, and rendering the mesh.

Classes

LegacyGLMesh

Represents a GPU-resident mesh with VAO/VBO/EBO/CBO/NBO structures for an indexed triangle mesh.

Classes

LegacyGLMesh

gl Mesh fir Compatibility Profile

Module Contents

class picogl.renderer.legacy_glmesh.LegacyGLMesh(vertices: numpy.ndarray, faces: numpy.ndarray, colors: numpy.ndarray | None = None, normals: numpy.ndarray | None = None, uvs: numpy.ndarray | None = None)[source]

gl Mesh fir Compatibility Profile

GPU‐resident mesh: owns VAO/VBO/EBO/CBO/NBO for an indexed triangle mesh. It does not know anything about shaders or matrices.

vertices[source]
colors[source]
normals[source]
uvs[source]
vao: picogl.gpu.buffers.vertex.legacy.VertexBufferGroup | None = None[source]
index_count: int = 0[source]
classmethod from_mesh_data(mesh: MeshData) LegacyGLMesh[source]

Construct a GLMesh from a MeshData container.

Parameters:

mesh (MeshData) – Must have .vertices (Nx3), .ebo (Mx1), optional .cbo (Nx3), .nbo (Nx3), uvs (Nx2)

Returns:

Ready-to-upload mesh (GPU buffers are allocated only when upload() is called).

Return type:

LegacyGLMesh

upload() None[source]

Allocate & fill GPU buffers.

generate_dynamic_attributes()[source]

generate_dynamic_attributes

Create layout that matches the VBOs being added

bind()[source]
unbind()[source]
delete()[source]

Free GPU resources.

__enter__()[source]
__exit__(exc_type, exc, tb)[source]
draw(mode=GLDrawMode.TRIANGLES) None[source]

Draw the mesh.