[framebuffers] Rendering after another framebuffer was bound

I have a pretty simple question about framebuffers,

If I were to bind a framebuffer, then draw to it, then bind anouther, then draw to it, then bind the first again and draw, will it’s image be distorted/broken in any way?

GL30.glBindFrameBuffer(GL30.GL_FRAMEBUFFER, firstFrameBuffer);
scene.renderAll();
GL30.glBindFrameBuffer(GL30.GL_FRAMEBUFFER, secondFrameBuffer);
scene_alt.renderAll();
GL30.glBindFrameBuffer(GL30.GL_FRAMEBUFFER, firstFrameBuffer);
scene_alt.renderAll();

Would fistFrameBuffer have the [scene] & [scene_at] drawn to it? Thanks in advance.

According to the code, both the framebuffers will share the same content, but it depends. Do [icode]scene_alt.renderAll();[/icode] has a call to [icode]glClear[/icode] method? If so, they both will have same content. Or else, it contains the scene_alt rendered on top of scene.

The best way to check is to render the contents of the framebuffers to the screen, and you’ll know what happens. Not quite sure about this.

I don’t have any way to test this, the call to glClear is done where the framebuffers are bound, so its fine. I just wanted to know if you stopped rendering to a frame buffer then re-bound it and drew anouther object, would both of their content be there.

Yes… Keep in mind though the necessity of correctly setting glViewport when dealing with different sized frame buffers. An easy way to test is simply bind a FBO, set the glViewport to the backing texture size, draw something, unbind, rebind set glViewport to something smaller and redraw. The 2nd drawing will be in the smaller view port size on top of the original drawing.

So yeah… not knowing what the rest of your rendering code does one does have to keep in mind calls to glViewport when binding / unbinding FBOs.