static void init_state (TestState *state) { int uniform_location; state->pipeline_red = create_pipeline_for_shader (state, color_source); uniform_location = cogl_pipeline_get_uniform_location (state->pipeline_red, "red"); cogl_pipeline_set_uniform_1f (state->pipeline_red, uniform_location, 1.0f); uniform_location = cogl_pipeline_get_uniform_location (state->pipeline_red, "green"); cogl_pipeline_set_uniform_1f (state->pipeline_red, uniform_location, 0.0f); uniform_location = cogl_pipeline_get_uniform_location (state->pipeline_red, "blue"); cogl_pipeline_set_uniform_1f (state->pipeline_red, uniform_location, 0.0f); state->pipeline_green = cogl_pipeline_copy (state->pipeline_red); uniform_location = cogl_pipeline_get_uniform_location (state->pipeline_green, "green"); cogl_pipeline_set_uniform_1f (state->pipeline_green, uniform_location, 1.0f); state->pipeline_blue = cogl_pipeline_copy (state->pipeline_red); uniform_location = cogl_pipeline_get_uniform_location (state->pipeline_blue, "blue"); cogl_pipeline_set_uniform_1f (state->pipeline_blue, uniform_location, 1.0f); state->matrix_pipeline = create_pipeline_for_shader (state, matrix_source); state->vector_pipeline = create_pipeline_for_shader (state, vector_source); state->int_pipeline = create_pipeline_for_shader (state, int_source); state->long_pipeline = NULL; }
static void update_uniforms (ShellAnamorphosisEffect *self) { ShellAnamorphosisEffectPrivate *priv = shell_anamorphosis_effect_get_instance_private (self); cogl_pipeline_set_uniform_1f (priv->pipeline, priv->_x_uniform, priv->_x); cogl_pipeline_set_uniform_1f (priv->pipeline, priv->_y_uniform, priv->_y); cogl_pipeline_set_uniform_1f (priv->pipeline, priv->_z_uniform, priv->_z); }
static void paint_color_pipelines (TestState *state) { CoglPipeline *temp_pipeline; int uniform_location; int i; /* Paint with the first pipeline that sets the uniforms to bright red */ paint_pipeline (state->pipeline_red, 0); /* Paint with the two other pipelines. These inherit from the red pipeline and only override one other component. The values for the two other components should be inherited from the red pipeline. */ paint_pipeline (state->pipeline_green, 1); paint_pipeline (state->pipeline_blue, 2); /* Try modifying a single pipeline for multiple rectangles */ temp_pipeline = cogl_pipeline_copy (state->pipeline_green); uniform_location = cogl_pipeline_get_uniform_location (temp_pipeline, "green"); for (i = 0; i <= 8; i++) { cogl_pipeline_set_uniform_1f (temp_pipeline, uniform_location, i / 8.0f); paint_pipeline (temp_pipeline, i + 3); } cogl_object_unref (temp_pipeline); }
static void update_factor_uniform (ShellGridDesaturateEffect *self) { if (self->factor_uniform > -1) cogl_pipeline_set_uniform_1f (self->pipeline, self->factor_uniform, self->factor); }