MeshProgram

moderngl_window.scene.MeshProgram[source]

Describes how a mesh is rendered using a specific shader program

Methods

MeshProgram.__init__(program: moderngl.program.Program = None, **kwargs)[source]

Initialize.

Parameters

program – The moderngl program

MeshProgram.draw(mesh, projection_matrix: numpy.ndarray = None, model_matrix: numpy.ndarray = None, camera_matrix: numpy.ndarray = None, time=0.0)[source]

Draw code for the mesh

Parameters

mesh (Mesh) – The mesh to render

Keyword Arguments
  • projection_matrix (numpy.ndarray) – projection_matrix (bytes)

  • model_matrix (numpy.ndarray) – view_matrix (bytes)

  • camera_matrix (numpy.ndarray) – camera_matrix (bytes)

  • time (float) – The current time

MeshProgram.apply(mesh)[source]

Determine if this MeshProgram should be applied to the mesh. Can return self or some MeshProgram instance to support dynamic MeshProgram creation

Parameters

mesh – The mesh to inspect

Attributes

MeshProgram.ctx

The current context

Type

moderngl.Context