Add support for transparent backbuffers to GLFW contexts (OpenGL3 and Vulkan) (reopens #2766) #7912
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note
This is a resuscitation of #2766, after the source repo was accidentally deleted! Contents of this PR are copied from the original PR
This PR adds support for the transparent backbuffers provided by ImGui.
It expands on the fix proposed in #2693
This is partially a bug-fix and partially a new feature. These changes fix alpha blending issues when drawing ImGui displays over transparent backbuffers, and also adds support for transparent viewports when using the viewport system.
Note that this also updates GLFW to version 3.3.
Example Image
Implementation Notes
Transparent framebuffer support is added via the
ImGuiConfigFlags_TransparentBackbuffers
flag.When used in conjunction with
GLFW_TRANSPARENT_FRAMEBUFFER
, this flag will bypass some constraints that forced a viewport window's alpha to be 1, and allows for windows to be created that support transparent backbuffers.The color and transparency of the backbuffer come from the style, specifically
ImGuiCol_WindowBg
, where w will represent the alpha value of the window being created.In addition to these changes, there is a small tweak to how the OpenGL3 and Vulkan implementations handle alpha blending to ensure proper blending with a transparent backbuffer.
These tweaks can be easily applied to other APIs that GLFW supports, the only change is to update the blend mode and get the clear color from the style instead of being hard coded.
Warning
the x64 lib for glfw3.lib was not built for vc2010, instead it was built for vc2012. The 32 bit version is still 2010