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

SDL alpha bleeds into the imgui windows #2873

Closed
RosculescuCiprian opened this issue Oct 27, 2019 · 2 comments
Closed

SDL alpha bleeds into the imgui windows #2873

RosculescuCiprian opened this issue Oct 27, 2019 · 2 comments

Comments

@RosculescuCiprian
Copy link

Version: 1.73 (17300)
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_opengl3.cpp + imgui_impl_sdl.cpp
Compiler: Visual Studio 2019 (MSVC)
Operating System: Windows 10 Home (1809)

My Issue/Question:

When setting windows opacity for an sdl window then the opacity is transferred through the imgui windows. I am using only the examples from the github examples folder

Result
transparent_issue

The expected result is just the imgui windows to be opaque

NOTE
This issue is the sdl equivalent for #2764 but the solutions that have worked there do not work here. See the examples

Standalone, minimal, complete and verifiable example:

These are the options that i tried from the examples in the repository

All the variants from imgui_impl_opengl3.cpp

function ImGui_ImplOpenGL3_SetupRenderState

glEnable(GL_BLEND); //glBlendEquation(GL_FUNC_ADD); glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_BLEND); //glBlendEquation(GL_FUNC_ADD); glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); //glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); //glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); //glBlendEquationSeparate(GL_FUNC_ADD, GL_MAX); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

In the main.cpp
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL3 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); SDL_GLContext gl_context = SDL_GL_CreateContext(window); SDL_SetWindowOpacity(window, 0.8f);

Any help with this issue is welcome.
Thank you.

@ocornut
Copy link
Owner

ocornut commented Oct 28, 2019

Linking to #2764, #2693 in case they may be related (note, haven't checked the issue in details at all).

ocornut added a commit that referenced this issue Feb 18, 2021
… accross all backends. (#2693, #2764, #2766, #2873, #3447, #3813, #3816)

Some of the viewport ideas from #2766 are not in there yet (e.g. Vulkan: setting compositeAlpha based on cap.supportedCompositeAlpha)
@ocornut
Copy link
Owner

ocornut commented Feb 18, 2021

Hello @RosculescuCiprian

Went through a bunch of backends and examples yesterday.
Fixed this with bda12e5 and 6a161b8 (we have 7 open issues related to this).

@ocornut ocornut closed this as completed Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants