views:

346

answers:

1

I have a frame buffer object in an OpenGL program with multiple colour attachments, and am trying to upgrade it to a multisampled FBO.

As I understand it, a multisampled FBO is only able to use render buffers, specifically ones created using glRenderbufferStorageMultisampleEXT. If I want something rendered to this FBO in a texture, I need to create a second FBO with textures for its attachments, then blit the multisampled FBO to the regular FBO using glBlitFramebufferEXT.

The very, very sparse examples I've seen assume a single colour attachment. What do I do when I want to blit multiple colour attachments?

+1  A: 

From the EXT_framebuffer_blit specification

12) Should we add support for multiple ReadBuffers, so that multiple color buffers may be copied with a single call to BlitFramebuffer?

Resolved: No, we considered this but the behavior is awkward to define and the functionality is of limited use.

From the arb_framebuffer_object specification (which superscedes the EXT_ version)

When the color buffer is transferred, values are taken from the read buffer of the read framebuffer and written to each of the draw buffers of the draw framebuffer, just as with CopyPixels.

So... It's pretty clear that you resolve only from a single color buffer per blit.

To do multiple ones, you need to do a Blit for each buffer, changing your READ_BUFFER for each buffer you want to blit, and select the corresponding draw buffer of the draw framebuffer.

Bahbar