mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 18:39:46 +00:00
keep the window framebuffer opaque
Both backends asked for an alpha channel (GLFW defaults to 8 alpha bits, the Wayland EGL config requested 8), so everything the engine draws with alpha - the UI panels, the water post effect - lowered the window's own alpha and the compositor blended the desktop through it. Visible on wine/Proton, where the whole window is composited. Both now ask for an opaque framebuffer: GLFW_ALPHA_BITS 0, and EGL_ALPHA_SIZE 0 with a fallback to an alpha config if the driver provides none. Checked the result through the back buffer attachment: alpha size is 0 on Wayland and on X11.
This commit is contained in:
parent
918051cd5d
commit
4731ac0706
2 changed files with 5 additions and 2 deletions
|
|
@ -603,6 +603,9 @@ std::tuple<
|
||||||
#endif
|
#endif
|
||||||
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
|
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
|
||||||
glfwWindowHint(GLFW_SAMPLES, settings->samples.get());
|
glfwWindowHint(GLFW_SAMPLES, settings->samples.get());
|
||||||
|
// opaque window: the UI is drawn with alpha and would otherwise
|
||||||
|
// blend with the desktop behind the window
|
||||||
|
glfwWindowHint(GLFW_ALPHA_BITS, 0);
|
||||||
|
|
||||||
auto window = glfwCreateWindow(width, height, title.c_str(), nullptr, nullptr);
|
auto window = glfwCreateWindow(width, height, title.c_str(), nullptr, nullptr);
|
||||||
if (window == nullptr) {
|
if (window == nullptr) {
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||||
EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
|
EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
|
||||||
EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,
|
EGL_ALPHA_SIZE, 0, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,
|
||||||
EGL_SAMPLES, samples > 0 ? samples : 0,
|
EGL_SAMPLES, samples > 0 ? samples : 0,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
@ -137,7 +137,7 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||||
EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
|
EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
|
||||||
EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,
|
EGL_ALPHA_SIZE, 0, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
eglChooseConfig(
|
eglChooseConfig(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue