Shader::set()
Sets a uniform of the shader: a value the shader reads but the
program decides, such as the time for an animation or a position on the
stage.
The name is the one the shader file declares, uniform float blocks;
is set with set("blocks", 20). There is a set for one or two
numbers or booleans, a Vector2, a
Color (as a vec3), and an array of
numbers, ncoords at a time, for an array uniform like
uniform vec3 lights[10];.
A uniform keeps its value until it is set again, so a value that changes is
set in run().
Examples
Syntax
Java
.set(name, x)
.set(name, x)
.set(name, x)
.set(name, x, y)
.set(name, x, y)
.set(name, x, y)
.set(name, vec)
.set(name, values, ncoords)
.set(name, values, ncoords)
.set(name, c)
Parameters
| Name | Data Type | Description |
|---|---|---|
| name | String | the name of the uniform in the shader file |
| x | int | the value |
| y | int | |
| vec | Vector2 | |
| values | int[] | |
| ncoords | int | |
| c | Color |
Return
void