Fixed restoration of previously bound FBO

This commit is contained in:
alexey.lysiuk 2016-04-30 16:29:22 +03:00
parent 32412c7f75
commit 4400d0cfcc
2 changed files with 4 additions and 1 deletions

View file

@ -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);
}
//===========================================================================

View file

@ -71,6 +71,7 @@ public:
int gl_spriteindex;
unsigned int mFBID;
unsigned int mVAOID;
int mOldFBID;
FTexture *gllight;
FTexture *glpart2;