Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.gl.Mesh class

Mesh

Contents

Buffer ownership and reference counting

Unlike in C++, where a GL::Buffer is either std::move()d into the mesh or referenced externally (with the user being responsible for its lifetime), the gl.Mesh object keeps references to all buffers added to it.

Methods

def add_vertex_buffer(self, buffer: Buffer, offset: int, stride: int, attribute: Attribute) -> None
Add vertex buffer
def draw(self, arg0: AbstractShaderProgram, /) -> None
Draw the mesh

Special methods

def __init__(self, primitive: MeshPrimitive = MeshPrimitive.TRIANGLES) -> None
Constructor
def __init__(self, primitive: magnum.MeshPrimitive) -> None
Constructor

Properties

buffers: typing.List[object] get
Buffer objects referenced by the mesh
count: int get set
Vertex/index count
id: int get
OpenGL vertex array ID
primitive: MeshPrimitive get set
Primitive type

Property documentation

magnum.gl.Mesh.primitive: MeshPrimitive get set

Primitive type

While querying this property will always give back a gl.MeshPrimitive, this property can be set using either magnum.MeshPrimitive or gl.MeshPrimitive, similarly to how the overloaded GL::Mesh::setPrimitive() works.