Bloodtoes
03-28-2011, 10:42 AM
Just a quick query if anyone here happens to know this before I spend too much time on a test case.
I need to render to a series of textures offscreen, which will later be sampled. What method should I expect to be faster? A case where I have a different framebuffer for each pass each with a 2D texture attached, or a single framebuffer and switching its color attachment for each pass?
For example:
// method one: multiple framebuffers (fb1, fb2, etc..)
// with corresponding texture attachment on color_attachment0
// which has already been set up
glBindFramebuffer( GL_FRAMEBUFFER, fb1 );
// pass 1
glBindFramebuffer( GL_FRAMEBUFFER, fb2 );
// pass 2
or
// method 2: single framebuffer, switching out
// attachment (tex1, tex2, etc...)
glBindFramebuffer( GL_FRAMEBUFFER, fb );
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex1, 0 );
// pass 1
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2, 0 );
// pass 2
I suspect the former, but I want to be sure. :)
I need to render to a series of textures offscreen, which will later be sampled. What method should I expect to be faster? A case where I have a different framebuffer for each pass each with a 2D texture attached, or a single framebuffer and switching its color attachment for each pass?
For example:
// method one: multiple framebuffers (fb1, fb2, etc..)
// with corresponding texture attachment on color_attachment0
// which has already been set up
glBindFramebuffer( GL_FRAMEBUFFER, fb1 );
// pass 1
glBindFramebuffer( GL_FRAMEBUFFER, fb2 );
// pass 2
or
// method 2: single framebuffer, switching out
// attachment (tex1, tex2, etc...)
glBindFramebuffer( GL_FRAMEBUFFER, fb );
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex1, 0 );
// pass 1
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex2, 0 );
// pass 2
I suspect the former, but I want to be sure. :)