From 4400d0cfcc4df9ca11d49f0ec495b580d4c53d02 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 30 Apr 2016 16:29:22 +0300 Subject: [PATCH] Fixed restoration of previously bound FBO --- src/gl/renderer/gl_renderer.cpp | 4 +++- src/gl/renderer/gl_renderer.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index e3b9b0a8b..9e8212c0b 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -122,6 +122,7 @@ void FGLRenderer::Initialize() else mLights = NULL; gl_RenderState.SetVertexBuffer(mVBO); mFBID = 0; + mOldFBID = 0; SetupLevel(); mShaderManager = new FShaderManager; @@ -237,6 +238,7 @@ void FGLRenderer::FlushTextures() bool FGLRenderer::StartOffscreen() { if (mFBID == 0) glGenFramebuffers(1, &mFBID); + glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &mOldFBID); glBindFramebuffer(GL_FRAMEBUFFER, mFBID); return true; } @@ -249,7 +251,7 @@ bool FGLRenderer::StartOffscreen() void FGLRenderer::EndOffscreen() { - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, mOldFBID); } //=========================================================================== diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index 52ce5b2fa..a78b8c5dc 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -71,6 +71,7 @@ public: int gl_spriteindex; unsigned int mFBID; unsigned int mVAOID; + int mOldFBID; FTexture *gllight; FTexture *glpart2;