Jump to content

  • Log In with Google      Sign In   
  • Create Account


Blitting Multiple render targets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 ic0de   Members   -  Reputation: 808

Like
0Likes
Like

Posted 22 November 2012 - 06:07 PM

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?

you know you program too much when you start ending sentences with semicolons;


Sponsor:

#2 Kaptein   Prime Members   -  Reputation: 1839

Like
0Likes
Like

Posted 22 November 2012 - 07:44 PM

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

#3 ic0de   Members   -  Reputation: 808

Like
0Likes
Like

Posted 22 November 2012 - 10:48 PM

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

Edited by ic0de, 22 November 2012 - 10:50 PM.

you know you program too much when you start ending sentences with semicolons;





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS