Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for transparent backbuffers to GLFW contexts (OpenGL3 and Vulkan) (reopens #2766) #7912

Open
wants to merge 1 commit into
base: docking
Choose a base branch
from

Conversation

SageMade
Copy link

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

63840839-b4893100-c94f-11e9-819a-157c3905c8c7

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

@ocornut ocornut changed the title Add support for transparent backbuffers to GLFW contexts (OpenGL3 and Vulkan) [Reopens #2766] Add support for transparent backbuffers to GLFW contexts (OpenGL3 and Vulkan) (reopens #2766) Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants