Skip to content

Commit d97a549

Browse files
committed
CpuTextureManager: Restore previous FBO
1 parent 4c21280 commit d97a549

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cputexturemanager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ bool CpuTextureManager::readTexture(
184184
}
185185

186186
// Bind the texture to the global FBO
187+
GLint oldFbo;
188+
glF.glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFbo);
187189
glF.glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
188190
glF.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, handle, 0);
189191

@@ -326,7 +328,7 @@ bool CpuTextureManager::readTexture(
326328
delete[] pixels;
327329

328330
// Cleanup
329-
glF.glBindFramebuffer(GL_FRAMEBUFFER, 0);
331+
glF.glBindFramebuffer(GL_FRAMEBUFFER, oldFbo);
330332

331333
return true;
332334
}

0 commit comments

Comments
 (0)