Blitting Multiple render targets

Started by
1 comment, last by ic0de 11 years, 5 months ago
Hi I have an fbo which contains two render targets. I can blit GL_COLOR_ATTACHMENT0_EXT and GL_DEPTH_ATTACHMENT_EXT like so:


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


But how would I go about blitting GL_COLOR_ATTACHMENT1_EXT?
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 :)
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.


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

This topic is closed to new replies.

Advertisement