From 6602e800ac554ee6b20fbb03df082120745344f9 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 8 May 2024 23:08:45 +0200 Subject: [PATCH] fix: Make sure texture multisampling framebuffer is being unbinded in all cases #1653 --- lib/libimhex/source/ui/imgui_imhex_extensions.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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;