diff --git a/docs/window.dox b/docs/window.dox index 37debd6ee..8c637f655 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -289,7 +289,9 @@ constraint. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @anchor GLFW_TRANSPARENT __GLFW_TRANSPARENT__ specifies whether the framebuffer will support transparency -in the background. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. +in the background. If transparency is not provided by your driver, GLFW will +gracefully fallback to opaque. It is possible to check for this outcome +with `glfwGetWindowAttrib()`. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. @subsubsection window_hints_mtr Monitor related hints diff --git a/src/context.c b/src/context.c index 3842f0a37..3c0d5e657 100644 --- a/src/context.c +++ b/src/context.c @@ -318,6 +318,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, } } + if (desired->transparent && closest->transparent != GLFW_TRUE) + { + // If we couldn't find a transparency match, + // update the fb hint for client checking. + _glfw.hints.framebuffer.transparent = GLFW_FALSE; + } return closest; } diff --git a/src/window.c b/src/window.c index 863f0ed23..3b53477c1 100644 --- a/src/window.c +++ b/src/window.c @@ -732,6 +732,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) return window->resizable; case GLFW_DECORATED: return window->decorated; + case GLFW_TRANSPARENT: + return _glfw.hints.framebuffer.transparent; case GLFW_FLOATING: return window->floating; case GLFW_AUTO_ICONIFY: