diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index 84dfcac04..34d10bb9b 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -119,6 +119,11 @@ namespace ImGuiExt { glGenFramebuffers(1, &framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); + // Unbind framebuffer on exit + ON_SCOPE_EXIT { + glBindFramebuffer(GL_FRAMEBUFFER, 0); + }; + // Attach texture to color attachment 0 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, texture, 0); @@ -131,9 +136,6 @@ namespace ImGuiExt { return texture; } - // Unbind framebuffer - glBindFramebuffer(GL_FRAMEBUFFER, 0); - #endif return texture;