ShaderProgram

Methods

ShaderProgram.uniform(name, value=None)

Set or get a uniform. If no value is specificed, the unform will be returned

Parameters:
  • name – Name of the uniform
  • value – Value for the uniform
Returns:

(optional) Uniform objects

ShaderProgram.prepare(reload=False)

Compiles all the shaders and links the program. If the linking is successful it builds the uniform and attribute map.

Parameters:reload – (boolean) Are we reloading this shader?

Source Methods

ShaderProgram.set_source(source:str)

Set a single source file. This is used when you have all shaders in one file separated by preprocessors.

Parameters:source – (string) The shader source
ShaderProgram.set_vertex_source(source:str)

Set the vertex shader source

Parameters:source – (string) Vertex shader source
ShaderProgram.set_geometry_source(source:str)

Set the geometry shader source

Parameters:source – (string) Geometry shader source
ShaderProgram.set_fragment_source(source:str)

Set the fragment shader source

Parameters:source – (string) Fragment shader source

Attributes

ShaderProgram.mglo

The ModernGL Program object