shader_set_uniform_i

Set a shader constant to a new integer value (or values).

Syntax:

GML Code Example

shader_set_uniform_i(handle, value1 [, value2, value3, value4]);


Argument Description
handle The handle of the shader constant to set.
value1 ... value4 The integer value (or values) to set the shader constant to.


Returns: N/A


Description

With this function you can set the value (or values) of a shader constant. You must previously have gotten the "handle" of the constant using the function shader_get_uniform, and you will have to know what type of constant it is to pass the correct number of integer values through to it, ie: if you have a vec2 you will need to pass two values to the function.

NOTE: All uniforms must be set after calling the function shader_set(), and before calling shader_reset.


Example:

GML Code Example

shader_set(shader_Glass);
 shader_params = shader_get_uniform(shader_glass, "u_vParams");
 shader_set_uniform_i(shader_params, 0, 65, 255);
 draw_self();
 shader_reset();
 

The above code will get the handle of the shader constant "u_vParams" ( a vec3), then set that constant to the given integer values.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here