clutter-shader: use cogl_program_set_uniform_xyz API

Instead of using the deprecated cogl_program_uniform_xyz functions we
now use the cogl_program_set_uniform methods. It looks like this should
also fix a problem with clutter-shader too in that previously we weren't
calling cogl_program_use before cogl_program_uniform_xyz so setting
uniforms would only work while the shader is enabled.
This commit is contained in:
Robert Bragg 2010-08-11 19:32:09 +01:00
parent f03037d580
commit c03544daa6

View File

@ -739,33 +739,38 @@ clutter_shader_set_uniform (ClutterShader *shader,
const GLfloat *floats; const GLfloat *floats;
floats = clutter_value_get_shader_float (value, &size); floats = clutter_value_get_shader_float (value, &size);
cogl_program_uniform_float (location, size, 1, floats); cogl_program_set_uniform_float (priv->program,
location, size, 1, floats);
} }
else if (CLUTTER_VALUE_HOLDS_SHADER_INT (value)) else if (CLUTTER_VALUE_HOLDS_SHADER_INT (value))
{ {
const int *ints; const int *ints;
ints = clutter_value_get_shader_int (value, &size); ints = clutter_value_get_shader_int (value, &size);
cogl_program_uniform_int (location, size, 1, ints); cogl_program_set_uniform_int (priv->program,
location, size, 1, ints);
} }
else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value)) else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value))
{ {
const GLfloat *matrix; const GLfloat *matrix;
matrix = clutter_value_get_shader_matrix (value, &size); matrix = clutter_value_get_shader_matrix (value, &size);
cogl_program_uniform_matrix (location, size, 1, FALSE, matrix); cogl_program_set_uniform_matrix (priv->program,
location, size, 1, FALSE, matrix);
} }
else if (G_VALUE_HOLDS_FLOAT (value)) else if (G_VALUE_HOLDS_FLOAT (value))
{ {
GLfloat float_val = g_value_get_float (value); GLfloat float_val = g_value_get_float (value);
cogl_program_uniform_float (location, 1, 1, &float_val); cogl_program_set_uniform_float (priv->program,
location, 1, 1, &float_val);
} }
else if (G_VALUE_HOLDS_INT (value)) else if (G_VALUE_HOLDS_INT (value))
{ {
int int_val = g_value_get_int (value); int int_val = g_value_get_int (value);
cogl_program_uniform_int (location, 1, 1, &int_val); cogl_program_set_uniform_int (priv->program,
location, 1, 1, &int_val);
} }
else else
g_assert_not_reached (); g_assert_not_reached ();