FBO MRT and multisampling

Started by
2 comments, last by wlb2001 13 years, 7 months ago
Hi there:
I have 2 problem with fbo;
1:
I bound 4 textures to 1 fbo with
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, m_fbo.tId, 0);
4 textures are diffrent size. 512 * 512, 256 * 256, 128 * 128 and 64 * 64
after I rendered secen,only the smallest size texture is correct, and all the others only update part of image(which equal to 64 * 64 at lower- left corner),is that means FBO MRT doesn't support different target size?

2:
I created 2 fbos, one use glRenderbufferStorageMultisample to get multisampling working,and after rendered secen, i use glBlitFramebufferEXT(0, 0,w1, h1, 0, 0, w2, h2, GL_COLOR_BUFFER_BIT, GL_NEAREST) to render fbo1 to fbo2's texture;
if w1 == w2 && h1 == h2, witch means fbo2's size same as fbo1's render storage, it works ,otherwise i get a black image.
so my quesstion is : does it have to be same size when blit from a multisampled fbo to other texture binded fbo?

Thanks for your helps
Advertisement
1.- The ARB and core FBO versions supports different size attachments, but the renderable area is the greatest area that fits all attachments, and that is what you're seeing here. If you render a 512x512 image, how do you expect it to be mapped to a 128x128 or 64x64 render target?

2.- No, they can be different sizes.
Quote:Original post by HuntsMan
2.- No, they can be different sizes.

The specs are a little ambiguous about this. A lot of graphics drivers will not work correctly if you try to blit/resolve an MS surface into a texture with non-equal dimensions.

The specs say this:
Quote:
If SAMPLE_BUFFERS for either the read framebuffer or
draw framebuffer is greater than zero, no copy is performed and an
INVALID_OPERATION error is generated if the dimensions of the source
and destination rectangles provided to BlitFramebuffer are not
identical


While that is a pretty clear "no", the spec kind of contradicts itself on various occasions over this statement. But in general resolving to a differently sized texture should be avoided, as it will most likely not work.
Really thanks for replys, and I learn a lot.
According to the answers, it seems that it isn't possible to get downsampled(and also multisampled) secen image in one path. Then only 2 choicese left.
1. gen a MS supported FBO with full screen size, blit to an equal size texture bind fbo, then generate 4 fbos and render quads for each one to get downsampled images.
2. almost same as above, but just use blit to get 4 texture binded fbos.
Which one should be faster?, because I have tried it on my project, I didn't see much FPS diffrence.
Btw, is there any other faster way to do this?
Tanks for your helps!

This topic is closed to new replies.

Advertisement