Commit 353cbdb8 authored by Martin Schultz's avatar Martin Schultz
Browse files

more versatile FBO preservation on makeCurrent

parent 5c07dda7
......@@ -234,6 +234,7 @@ glViewer::~glViewer()
void glViewer::makeCurrent() {
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,4))
const GLuint prevFbo = ACG::GLState::getFramebufferDraw();
const GLuint prevReadFbo = ACG::GLState::getFramebufferRead();
#endif
// calling makeCurrent binds the default FBO when QOpenGLWidget is used
......@@ -242,7 +243,9 @@ void glViewer::makeCurrent() {
#if (QT_VERSION >= QT_VERSION_CHECK(5,4,4))
//restore the previously bound FBO, if it was not 0 as Qt Documentation says we shall not bind 0
if(prevFbo != 0)
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER, prevFbo);
ACG::GLState::bindFramebuffer(GL_DRAW_FRAMEBUFFER, prevFbo);
if(prevReadFbo != 0)
ACG::GLState::bindFramebuffer(GL_READ_FRAMEBUFFER, prevFbo);
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment