From 97afbb208a619d12d774ba7f21f7d08683ac8093 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 10 Nov 2021 01:52:27 +0200 Subject: [PATCH] Ensure that creating the system framebuffer doesn't change the binding Just in case it's for some reason created at an odd time. --- source/backends/opengl/systemframebuffer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/backends/opengl/systemframebuffer.cpp b/source/backends/opengl/systemframebuffer.cpp index dbfe0b82..2d066452 100644 --- a/source/backends/opengl/systemframebuffer.cpp +++ b/source/backends/opengl/systemframebuffer.cpp @@ -12,6 +12,11 @@ OpenGLSystemFramebuffer::OpenGLSystemFramebuffer(): if(EXT_framebuffer_object) { + int old_id; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &old_id); + if(old_id) + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_BINDING, 0); + int value; glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value); if(value==GL_NONE) @@ -26,6 +31,9 @@ OpenGLSystemFramebuffer::OpenGLSystemFramebuffer(): glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &value); if(value!=GL_NONE) sys_format = (sys_format, STENCIL_ATTACHMENT); + + if(old_id) + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_BINDING, old_id); } else // Make a guess if we can't query the format -- 2.43.0