aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2018-03-19 15:45:34 +0100
committerGuido Günther <agx@sigxcpu.org>2018-03-20 14:30:30 +0100
commit2d01663b2559c6d6a121c18b9496248dce8ad1a2 (patch)
treef375ea1d89698d18615584460fa2b1c0e29ebd85 /render
parent13e4ba4867c0b5ab2193728d6a4192007fe8276b (diff)
gles2: Honor alpha in fragment_src_external
By using the same vertex shader and adding alpha to the fragment shader for external textures we can: - use alpha blending - have wlr_gles2_render_texture_with_matrix work with the GL_TEXTURE_EXTERNAL_OES. So far this failed since we passed in alpha which was unknown by fragment_src_external
Diffstat (limited to 'render')
-rw-r--r--render/gles2/renderer.c2
-rw-r--r--render/gles2/shaders.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 55797805..f525869d 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -90,7 +90,7 @@ static void init_default_shaders() {
goto error;
}
if (glEGLImageTargetTexture2DOES) {
- if (!compile_program(quad_vertex_src, fragment_src_external,
+ if (!compile_program(vertex_src, fragment_src_external,
&shaders.external)) {
goto error;
}
diff --git a/render/gles2/shaders.c b/render/gles2/shaders.c
index 2e9386d0..30e12e4c 100644
--- a/render/gles2/shaders.c
+++ b/render/gles2/shaders.c
@@ -80,8 +80,9 @@ const GLchar fragment_src_external[] =
"precision mediump float;"
"varying vec2 v_texcoord;"
"uniform samplerExternalOES texture0;"
+"uniform float alpha;"
""
"void main() {"
" vec4 col = texture2D(texture0, v_texcoord);"
-" gl_FragColor = vec4(col.rgb, col.a);"
+" gl_FragColor = vec4(col.rgb, col.a * alpha);"
"}";