Sign in to follow this  
ic0de

Blitting Multiple render targets

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this