mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
[164/906] rename blend_fragment_source to sum_fragment_source and add uniform blending parameters
This commit is contained in:
parent
aa7e3867ac
commit
c5bd6fdbc5
3 changed files with 9 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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;"
|
||||
"}";
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Reference in a new issue