1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
Uniform
=======
.. py:class:: Uniform
Available in :py:meth:`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 :py:meth:`Program.__getitem__`
or :py:meth:`Program.__iter__`
Methods
-------
.. py:method:: read() -> bytes:
Read the value of the uniform.
.. py:method:: write(data: Any) -> None:
Write the value of the uniform.
Attributes
----------
.. py:attribute:: Uniform.location
:type: int
The location of the uniform.
The result of the glGetUniformLocation.
.. py:attribute:: Uniform.array_length
:type: int
If the uniform is an array the array_length is the length of the array otherwise `1`.
.. py:attribute:: Uniform.dimension
:type: int
The uniform dimension.
.. py:attribute:: Uniform.name
:type: str
The uniform name.
The name does not contain leading `[0]`.
The name may contain `[ ]` when the uniform is part of a struct.
.. py:attribute:: Uniform.value
:type: Any
The uniform value stored in the program object.
.. py:attribute:: Uniform.extra
:type: Any
User defined data.
|