if(!in_frame)
setup_frame();
+ const Framebuffer *out_fbo = Framebuffer::current();
+ /* Binding the current object is a no-op, but this will restore the original
+ FBO in case an exception is thrown. */
+ Bind restore_fbo(out_fbo, true);
+
if(target[0])
{
Framebuffer &fbo = (samples ? target_ms->fbo : target[0]->fbo);
- // XXX exception safety
fbo.bind();
fbo.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
}
if(i+1<postproc.size())
target[1-j]->fbo.bind();
else
- Framebuffer::unbind();
+ out_fbo->bind();
postproc[i]->render(target[j]->color, target[j]->depth);
}
- Framebuffer::unbind();
+ out_fbo->bind();
}
if(!was_in_frame)