mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
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
This commit is contained in:
parent
13e4ba4867
commit
2d01663b25
2 changed files with 3 additions and 2 deletions
|
@ -90,7 +90,7 @@ static void init_default_shaders() {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (glEGLImageTargetTexture2DOES) {
|
if (glEGLImageTargetTexture2DOES) {
|
||||||
if (!compile_program(quad_vertex_src, fragment_src_external,
|
if (!compile_program(vertex_src, fragment_src_external,
|
||||||
&shaders.external)) {
|
&shaders.external)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,9 @@ const GLchar fragment_src_external[] =
|
||||||
"precision mediump float;"
|
"precision mediump float;"
|
||||||
"varying vec2 v_texcoord;"
|
"varying vec2 v_texcoord;"
|
||||||
"uniform samplerExternalOES texture0;"
|
"uniform samplerExternalOES texture0;"
|
||||||
|
"uniform float alpha;"
|
||||||
""
|
""
|
||||||
"void main() {"
|
"void main() {"
|
||||||
" vec4 col = texture2D(texture0, v_texcoord);"
|
" vec4 col = texture2D(texture0, v_texcoord);"
|
||||||
" gl_FragColor = vec4(col.rgb, col.a);"
|
" gl_FragColor = vec4(col.rgb, col.a * alpha);"
|
||||||
"}";
|
"}";
|
||||||
|
|
Loading…
Reference in a new issue