Open gui2one opened 1 year ago
Dear ImGui currently doesn't play nice with sRGB backbuffers. https://github.com/ocornut/imgui/issues/578 https://github.com/ocornut/imgui/issues/1724 https://github.com/ocornut/imgui/pull/2943 https://github.com/ocornut/imgui/issues/4890
Unfortunately no consensus has been reached on what the appropriate fix should be.
The maybe-good-enough bandaid fix is to add a sRGB->linear conversion to the end of the pixel shader in the backend to counter-act the implicit linear->sRGB conversion.
Config/Build Information (copied from Demo Window)
Version/Branch of Dear ImGui:
Version: 1.87 WIP Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp Compiler: MSVC Operating System: Windows10
My Issue/Question:
I am building a small OpenGL Renderer. I struggled a lot with linear/sRGB workflow, and finally settle on using
glEnable(GL_FRAMEBUFFER_SRGB)
witch is apparently pretty much free, and means I don't have to do all the work in fragment shaders. So it's a no brainer. But once in ImGui, the viewport where I renderer my scene is OK, but ImGui colors are too bright.
And trying to enable and disable GL_FRAMEBUFFER_SRGB before and after the ImGui window creation doesn't work. I either have ImGui colors to bright and viewport OK, or ImGui colors OK but viewport too dark;
The scene is rendererd to a framebuffer, which I then display in ImGui window using ImGui::Image() display the scene
Is there a way apply a fragment shader to the image displayed by ImGui::Image ? (to apply a final gamma correction just for the viewport )
Screenshots/Video