SDL alpha bleeds into the imgui windows #2873

Closed
opened 2019-10-27 00:44:01 +00:00 by RosculescuCiprian · 2 comments
RosculescuCiprian commented 2019-10-27 00:44:01 +00:00 (Migrated from github.com)

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.

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](https://user-images.githubusercontent.com/4421250/67627670-366edb00-f869-11e9-8165-d24a88930953.png) 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 1. `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);` 2. `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);` 3. `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);` 4. `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 commented 2019-10-28 09:02:38 +00:00 (Migrated from github.com)

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

Linking to #2764, #2693 in case they may be related (note, haven't checked the issue in details at all).
ocornut commented 2021-02-18 12:51:40 +00:00 (Migrated from github.com)

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).

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).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#2873
No description provided.