Milan Stezka
05-11-2011, 08:17 AM
Hi,
I need to explain some unexpected behavior which I have been experiencing. I do the usual stuff:
1. draw some objects into a multisampled FBO texture attachment
2. draw a mirror reflection of the scene into another single sampled FBO texture attachment
3. draw some more objects like in the first step
4. resolve the multisampled attachment into a single sampled texture
Strange thing happens in the 4th phase. The glBlitFramebuffer overwrites both the texture used for mirror rendering (unexpected behavior) and the texture for antialiasing resolve (expected behavior). I thought that it is impossible to have more than one FBO bound at the same time. I can fix this at the end of the second step, where I bind again the FBO used in the first phase. It is done by a simple call:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferObjectWithMultiSampledAttachments);
So to fix it I have to first unbind the mirror FBO by specifying the 0 object and then binding another object. I thought that any bound FBOs are unbound automatically by binding another FBO. Is this a common behavior or is just some quirk in my code? I use nVidia GT 220 Mobile with 260.99 drivers.
Thank you for your opinions
I need to explain some unexpected behavior which I have been experiencing. I do the usual stuff:
1. draw some objects into a multisampled FBO texture attachment
2. draw a mirror reflection of the scene into another single sampled FBO texture attachment
3. draw some more objects like in the first step
4. resolve the multisampled attachment into a single sampled texture
Strange thing happens in the 4th phase. The glBlitFramebuffer overwrites both the texture used for mirror rendering (unexpected behavior) and the texture for antialiasing resolve (expected behavior). I thought that it is impossible to have more than one FBO bound at the same time. I can fix this at the end of the second step, where I bind again the FBO used in the first phase. It is done by a simple call:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferObjectWithMultiSampledAttachments);
So to fix it I have to first unbind the mirror FBO by specifying the 0 object and then binding another object. I thought that any bound FBOs are unbound automatically by binding another FBO. Is this a common behavior or is just some quirk in my code? I use nVidia GT 220 Mobile with 260.99 drivers.
Thank you for your opinions