From 2993f7ae7dd88ccd9180163a03ea41abc3397b9c Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 30 Jan 2021 23:56:12 -0500 Subject: [PATCH] [client] egl: create 24-bit colour context This should prevent the looking-glass-client window from having an alpha channel. On Wayland, the alpha channel is used to compose the window onto the desktop, so the wallpaper would bleed through unless set to complete opaque. We worked around this by using constant alpha for rendering, but it was not sustainable. Instead, we should just ask for 24-bit context. --- client/renderers/EGL/egl.c | 2 +- client/renderers/EGL/help.c | 5 +---- client/renderers/EGL/shader/help_bg.frag | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index ccd6f79b..8712d5fb 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -518,7 +518,7 @@ bool egl_render_startup(void * opaque) EGLint attr[] = { - EGL_BUFFER_SIZE , 32, + EGL_BUFFER_SIZE , 24, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SAMPLE_BUFFERS , maxSamples > 0 ? 1 : 0, EGL_SAMPLES , maxSamples, diff --git a/client/renderers/EGL/help.c b/client/renderers/EGL/help.c index f94dbb76..0a659b31 100644 --- a/client/renderers/EGL/help.c +++ b/client/renderers/EGL/help.c @@ -186,8 +186,7 @@ void egl_help_render(EGL_Help * help, const float scaleX, const float scaleY) return; glEnable(GL_BLEND); - glBlendColor(0, 0, 0, 0.5); - glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // render the background first egl_shader_use(help->shaderBG); @@ -195,8 +194,6 @@ void egl_help_render(EGL_Help * help, const float scaleX, const float scaleY) glUniform2f(help->uSizeBG , help->width, help->height); egl_model_render(help->model); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // render the texture over the background egl_shader_use(help->shader); glUniform2f(help->uScreen, scaleX , scaleY ); diff --git a/client/renderers/EGL/shader/help_bg.frag b/client/renderers/EGL/shader/help_bg.frag index 3171af14..5a33e8d1 100644 --- a/client/renderers/EGL/shader/help_bg.frag +++ b/client/renderers/EGL/shader/help_bg.frag @@ -4,5 +4,5 @@ out highp vec4 color; void main() { - color = vec4(0.0, 0.0, 1.0, 1.0); + color = vec4(0.0, 0.0, 1.0, 0.5); }