Main | API | WebRender | setShaderVariable


setShaderVariable(name, value);

Allows you to update a global shader variable. This is the only thread-safe way to update a shader variable.


name - [String]

The name of the variable being updated. This is NOT a reference to the variable.

value - [Variable]

The value the variable is set to.




Shader variables are supposed to be defined in the global scope, so you could simply update them directly with your application. However, in the case of multi-threading, you cannot do that, therefore this function is provided that will work in any mode. It is good practice to update variables through this function. Shader variables can have any values or data structure assigned to them, and if WebRender is not running in multi-threaded mode, then references will be passed and not copies.

See more detailed information about shaders here.

See more detailed information about multi-threading here.

Additional Notes