summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2018-10-05 01:19:29 +1000
committerMatthew Waters <matthew@centricular.com>2018-10-05 01:21:01 +1000
commita164d868046ba6f3e1659b3fab431c5e8de19926 (patch)
treea129cc69a08fce9cea939f8af079d2c73a8be9a4
parent6e591403a77282a7bef24d5d5c671a6d0d788c16 (diff)
downloadgst-plugins-base-a164d868046ba6f3e1659b3fab431c5e8de19926.tar.gz
gst-plugins-base-a164d868046ba6f3e1659b3fab431c5e8de19926.tar.xz
Revert "Revert "gl: use correct blend functions for unpremultiplied alpha""
This reverts commit 452d90a88c6e68a3daa38e02213782836788236a. This was actually correct. sorry for the noise!
-rw-r--r--ext/gl/gstglimagesink.c9
-rw-r--r--ext/gl/gstgloverlay.c6
2 files changed, 13 insertions, 2 deletions
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index 30062d07e..aa0ae40b7 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -2250,7 +2250,14 @@ gst_glimage_sink_on_draw (GstGLImageSink * gl_sink)
if (gl_sink->ignore_alpha) {
gl->BlendColor (0.0, 0.0, 0.0, alpha);
- gl->BlendFunc (GL_SRC_ALPHA, GL_CONSTANT_COLOR);
+ if (gl->BlendFuncSeparate) {
+ gl->BlendFuncSeparate (GL_SRC_ALPHA, GL_CONSTANT_COLOR, GL_ONE,
+ GL_ONE_MINUS_SRC_ALPHA);
+ } else {
+ /* we don't have separate blend modes, perform something close to
+ * correct instead */
+ gl->BlendFunc (GL_SRC_ALPHA, GL_CONSTANT_COLOR);
+ }
gl->BlendEquation (GL_FUNC_ADD);
gl->Enable (GL_BLEND);
}
diff --git a/ext/gl/gstgloverlay.c b/ext/gl/gstgloverlay.c
index 864ea64da..59096cb32 100644
--- a/ext/gl/gstgloverlay.c
+++ b/ext/gl/gstgloverlay.c
@@ -530,7 +530,11 @@ gst_gl_overlay_callback (GstGLFilter * filter, GstGLMemory * in_tex,
gst_gl_shader_set_uniform_1f (overlay->shader, "alpha", overlay->alpha);
gl->Enable (GL_BLEND);
- gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ if (gl->BlendFuncSeparate)
+ gl->BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE,
+ GL_ONE_MINUS_SRC_ALPHA);
+ else
+ gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl->BlendEquation (GL_FUNC_ADD);
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0);