Uniform#

class Uniform#

Available in Program.__getitem__()

A uniform is a global GLSL variable declared with the ‘uniform’ storage qualifier.

These act as parameters that the user of a shader program can pass to that program.

In ModernGL, Uniforms can be accessed using Program.__getitem__() or Program.__iter__()

Methods#

read() bytes:#

Read the value of the uniform.

write(data: Any) None:#

Write the value of the uniform.

Attributes#

Uniform.location: int#

The location of the uniform. The result of the glGetUniformLocation.

Uniform.array_length: int#

If the uniform is an array the array_length is the length of the array otherwise 1.

Uniform.dimension: int#

The uniform dimension.

Uniform.name: str#

The uniform name.

The name does not contain leading [0]. The name may contain [ ] when the uniform is part of a struct.

Uniform.value: Any#

The uniform value stored in the program object.

Uniform.extra: Any#

User defined data.