Sets the shader’s uniform (global) variables.
Shader programs run on the computer’s graphics processing unit (GPU). They live in part of the computer’s memory that’s completely separate from the sketch that runs them. Uniforms are global variables within a shader program. They provide a way to pass values from a sketch running on the CPU to a shader program running on the GPU.
The first parameter, uniformName, is a string with the uniform’s name. For the shader above, uniformName would be 'r'.
The second parameter, data, is the value that should be used to set the uniform. For example, calling myShader.setUniform('r', 0.5) would set the r uniform in the shader above to 0.5. data should match the uniform’s type. Numbers, strings, booleans, arrays, and many types of images can all be passed to a shader with setUniform().
Ejemplos
Sintaxis
setUniform(uniformName, data)
Parámetros
Referencias Relacionadas
ambientMaterial
Establece el color ambiental del material de la superficie de las formas.
createFilterShader
Crea un objeto p5.Shader para ser utilizado con la función filter().
createShader
Crea un nuevo objeto p5.Shader.
emissiveMaterial
Establece el color de emisión del material de la superficie de las formas.