From c5bd6fdbc53c796a494876c72be5615408096576 Mon Sep 17 00:00:00 2001 From: Filippo Argiolas Date: Thu, 14 Aug 2008 09:39:55 +0200 Subject: [PATCH] [164/906] rename blend_fragment_source to sum_fragment_source and add uniform blending parameters --- gst/gl/effects/gstgleffectglow.c | 6 ++++-- gst/gl/effects/gstgleffectssources.c | 6 ++++-- gst/gl/effects/gstgleffectssources.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gst/gl/effects/gstgleffectglow.c b/gst/gl/effects/gstgleffectglow.c index 4fe53d8152..460e64e536 100644 --- a/gst/gl/effects/gstgleffectglow.c +++ b/gst/gl/effects/gstgleffectglow.c @@ -145,7 +145,7 @@ gst_gl_effects_glow_step_four (gint width, gint height, guint texture, gpointer } g_return_if_fail ( - gst_gl_shader_compile_and_check (shader, blend_fragment_source, + gst_gl_shader_compile_and_check (shader, sum_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)); glMatrixMode (GL_PROJECTION); @@ -158,13 +158,15 @@ gst_gl_effects_glow_step_four (gint width, gint height, guint texture, gpointer glBindTexture (GL_TEXTURE_RECTANGLE_ARB, effects->intexture); glDisable(GL_TEXTURE_RECTANGLE_ARB); + gst_gl_shader_set_uniform_1f (shader, "alpha", 1.0); gst_gl_shader_set_uniform_1i (shader, "base", 2); - + glActiveTexture (GL_TEXTURE1); glEnable (GL_TEXTURE_RECTANGLE_ARB); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, texture); glDisable(GL_TEXTURE_RECTANGLE_ARB); + gst_gl_shader_set_uniform_1f (shader, "beta", 1/3.5); gst_gl_shader_set_uniform_1i (shader, "blend", 1); gst_gl_effects_draw_texture (effects, texture); diff --git a/gst/gl/effects/gstgleffectssources.c b/gst/gl/effects/gstgleffectssources.c index d151eb5e1e..77485a46fb 100644 --- a/gst/gl/effects/gstgleffectssources.c +++ b/gst/gl/effects/gstgleffectssources.c @@ -132,12 +132,14 @@ const gchar *vconv9_fragment_source = "}"; /* TODO: support several blend modes */ -const gchar *blend_fragment_source = +const gchar *sum_fragment_source = "#extension GL_ARB_texture_rectangle : enable\n" "uniform sampler2DRect base;" "uniform sampler2DRect blend;" +"uniform float alpha;" +"uniform float beta;" "void main () {" " vec4 basecolor = texture2DRect (base, gl_TexCoord[0].st);" " vec4 blendcolor = texture2DRect (blend, gl_TexCoord[0].st);" -" gl_FragColor = basecolor + blendcolor / 3.5;" +" gl_FragColor = alpha * basecolor + beta * blendcolor;" "}"; diff --git a/gst/gl/effects/gstgleffectssources.h b/gst/gl/effects/gstgleffectssources.h index c20d998a80..aba2c0c7df 100644 --- a/gst/gl/effects/gstgleffectssources.h +++ b/gst/gl/effects/gstgleffectssources.h @@ -29,6 +29,6 @@ const gchar *stretch_fragment_source; const gchar *luma_threshold_fragment_source; const gchar *hconv9_fragment_source; const gchar *vconv9_fragment_source; -const gchar *blend_fragment_source; +const gchar *sum_fragment_source; #endif /* __GST_GL_EFFECTS_SOURCES_H__ */