Method
ClutterShaderEffectset_uniform
Declaration [src]
void
clutter_shader_effect_set_uniform (
ClutterShaderEffect* effect,
const gchar* name,
GType gtype,
gsize n_values,
...
)
Description [src]
Sets a list of values as the payload for the uniform name
inside
the shader effect
The gtype
must be one of: G_TYPE_INT
, for 1 or more integer values;
G_TYPE_FLOAT
, for 1 or more floating point values;
CLUTTER_TYPE_SHADER_INT
, for a pointer to an array of integer values;
CLUTTER_TYPE_SHADER_FLOAT
, for a pointer to an array of floating point
values; and CLUTTER_TYPE_SHADER_MATRIX
, for a pointer to an array of
floating point values mapping a matrix
The number of values interpreted is defined by the n_value
argument, and by the gtype
argument. For instance, a uniform named
“sampler0” and containing a single integer value is set using:
clutter_shader_effect_set_uniform (effect, "sampler0",
G_TYPE_INT, 1,
0);
While a uniform named “components” and containing a 3-elements vector of floating point values (a “vec3”) can be set using:
gfloat component_r, component_g, component_b;
clutter_shader_effect_set_uniform (effect, "components",
G_TYPE_FLOAT, 3,
component_r,
component_g,
component_b);
or can be set using:
gfloat component_vec[3];
clutter_shader_effect_set_uniform (effect, "components",
CLUTTER_TYPE_SHADER_FLOAT, 3,
component_vec);
Finally, a uniform named “map” and containing a matrix can be set using:
float v[16];
cogl_matrix_to_float (&matrix, v);
clutter_shader_effect_set_uniform (effect, "map",
CLUTTER_TYPE_SHADER_MATRIX,
1, v);
This method is not directly available to language bindings.