OpenGL MRT (Color Attachments) with Multisampling


I have a FBO object, that has 2 color attachments, the second attachment stores normal data. I multisample this FBO using a multisample FBO,
but when I render the second attachment, the scene is getting displayed and not the normal data, and NOT multisampled! The multisample FBO, I tried it with 1 and 2 color attachments but still
it doesn’t work. I’ve already tested the FBO without the multisample FBO and the normal data is appearing fine then, but, I need to multisample my scene and
leave the normal data in the second color attachment un-touched.

So basically, I want to multisample 1 color attachment in a 2 color attachment FBO, leaving the 2nd color attachment untouched (not multisampled). I’ve been
exhausting different possibilities but nothing seems to work.

My current glDrawBuffers are both color attachments.

Is this possible in OpenGL? I’ve tried with single and 2 color attachments in the multisample FBO. is there anything I’m doing wrong?

btw, all my FBO are fine after checking their status, so FBO creation was successful.


You can’t use multisample-fbo attachments as textures. If you want to use the data as textures, you have to blit it into a non-multisample fbo first.

So your rendering-code would change to:
attach the ms-target
render your stuff
blit the ms-fbo to a normal fbo
use the attachments of the normal fbo as datasource

Actually I’m doing that. Multisampling works fine with a single color attachment.

Here’s a more elaborate way,

bind ms-target with 2 color attachments
render stuff
blit ms-fbo with 2 color attachments
use attachment of normal fbo as datasource

and when I do this, the 2nd color attachment doesn’t
have what its supposed to have, this only occurs after blitting.

But, what I want to do is,

create FBO with 2 colour attachments

bind ms target;
render scene to color attachment 0;
at the same time, render normal vectors to color attachment 1;
somehow blit ONLY colour attachment 0

use both attachments as data sources

Still not working! Is multisampling only a single attachment of a multiple attachment FBO un supported?

I don’t think that MRT is supported for ms rendertargets for current hw

Then the only way to do any type of AA, when using MRT would be to do it manually? and/or Use separate FBO’s? any suggestions?