[164/906] rename blend_fragment_source to sum_fragment_source and add uniform blending parameters

This commit is contained in:
Filippo Argiolas 2008-08-14 09:39:55 +02:00 committed by Matthew Waters
parent aa7e3867ac
commit c5bd6fdbc5
3 changed files with 9 additions and 5 deletions

View file

@ -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,6 +158,7 @@ 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);
@ -165,6 +166,7 @@ gst_gl_effects_glow_step_four (gint width, gint height, guint texture, gpointer
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);

View file

@ -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;"
"}";

View file

@ -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__ */