summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2010-08-05 15:36:37 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2010-08-18 16:39:11 +0100
commit1e3cfe33702ccc7b5bafdc609befa1ccd0de4564 (patch)
tree33b3a5496599eb6d061bf56b648be8b2a474e41c
parent549aedf338f9cce9cf25add9c73fb4826bdea4cd (diff)
sink: make glsl codepaths use cogl_material_set_user_program
Using cogl_program_use() to bind a program to the context so it gets used with all subsequent materials is considered deprecated and will internally result in us having to create lots of one-shot override materials which isn't optimal.
-rw-r--r--clutter-gst/clutter-gst-video-sink.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 0478614..d672e6e 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -611,9 +611,6 @@ clutter_gst_yv12_glsl_paint (ClutterActor *actor,
material = clutter_texture_get_cogl_material (CLUTTER_TEXTURE (actor));
- /* bind the shader */
- cogl_program_use (priv->program);
-
/* Bind the U and V textures in layers 1 and 2 */
if (priv->u_tex)
cogl_material_set_layer (material, 1, priv->u_tex);
@@ -631,9 +628,6 @@ clutter_gst_yv12_glsl_post_paint (ClutterActor *actor,
material = clutter_texture_get_cogl_material (CLUTTER_TEXTURE (actor));
cogl_material_remove_layer (material, 1);
cogl_material_remove_layer (material, 2);
-
- /* disable the shader */
- cogl_program_use (COGL_INVALID_HANDLE);
}
static void
@@ -641,6 +635,7 @@ clutter_gst_yv12_glsl_init (ClutterGstVideoSink *sink)
{
ClutterGstVideoSinkPrivate *priv= sink->priv;
GLint location;
+ CoglMaterial *material;
clutter_gst_video_sink_set_glsl_shader (sink, yv12_to_rgba_shader);
@@ -654,6 +649,9 @@ clutter_gst_yv12_glsl_init (ClutterGstVideoSink *sink)
cogl_program_use (COGL_INVALID_HANDLE);
+ material = clutter_texture_get_cogl_material (priv->texture);
+ cogl_material_set_user_program (material, priv->program);
+
_renderer_connect_signals (sink,
clutter_gst_yv12_glsl_paint,
clutter_gst_yv12_glsl_post_paint);
@@ -734,6 +732,7 @@ clutter_gst_i420_glsl_init (ClutterGstVideoSink *sink)
{
ClutterGstVideoSinkPrivate *priv = sink->priv;
GLint location;
+ CoglMaterial *material;
clutter_gst_video_sink_set_glsl_shader (sink, yv12_to_rgba_shader);
@@ -746,6 +745,9 @@ clutter_gst_i420_glsl_init (ClutterGstVideoSink *sink)
cogl_program_uniform_1i (location, 2);
cogl_program_use (COGL_INVALID_HANDLE);
+ material = clutter_texture_get_cogl_material (priv->texture);
+ cogl_material_set_user_program (material, priv->program);
+
_renderer_connect_signals (sink,
clutter_gst_yv12_glsl_paint,
clutter_gst_yv12_glsl_post_paint);