• Advertisement
Sign in to follow this  

Blitting Multiple render targets

This topic is 1882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I have an fbo which contains two render targets. I can blit GL_COLOR_ATTACHMENT0_EXT and GL_DEPTH_ATTACHMENT_EXT like so:

[CODE]
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo0);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo1);
glBlitFramebufferEXT(0, 0, screenw, screenh, 0, 0, screenw, screenh, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT, GL_NEAREST);
[/CODE]

But how would I go about blitting GL_COLOR_ATTACHMENT1_EXT?

Share this post


Link to post
Share on other sites
Advertisement
you are not blitting attachments, you are blitting the contents of your FBO
in this case you are blitting the color content of your FBO to another FBO
at the same time you are also copying the depth data to another (same destination) FBO

unfortunately i don't know how to copy contents of textures to FBOs or other textures
because that's what attachments are: textures, or (storage) "formats"
but i'm sure someone will confirm :)

Share this post


Link to post
Share on other sites
I hate answering my own questions but I'll put this here in case anyone needs it. I came up with an ugly solution that involves doing two blits changing glDrawBuffer in between.

[CODE]
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fbo0);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo1);
glBlitFramebufferEXT(0, 0, screenw, screenh, 0, 0, screenw, screenh, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT, GL_NEAREST);
glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
glBlitFramebufferEXT(0, 0, screenw, screenh, 0, 0, screenw, screenh, GL_COLOR_BUFFER_BIT, GL_NEAREST);
[/CODE] Edited by ic0de

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement