PDA

View Full Version : FBO, sharing render buffers



V-man
01-28-2006, 01:04 PM
Hello,

Let's say I want to render_to_texture and I only care for the color texture. I can share a depth render buffer between my FBOs, right?

IIRC, the render buffer must be the same size as the color texture. This hasn't changed yet?

What if I do

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID1);

//some other setup code go here

glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBufferID);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID2);

//some other setup code go here

glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBufferID);Does this mean the depth render buffer is now bound to 2 FBOs?

shelll
01-28-2006, 10:46 PM
yes, they must have the same size.

i think that prefered method is having one fbo and changing the color attachment. but yours should also work.

V-man
01-29-2006, 10:45 AM
I hadn't thought of that, but it sounds possible. I'm just worried about performance implications here.

I'm also having some other problem where glFramebufferTexture2DEXT gives a GL_INVALID_OPERATION when I try to create certain FBOs. Doesn't make sense.

shelll
01-29-2006, 11:39 PM
performance should be better then switching fbos.

look in spec for what can cause invalid operation. if you post some code, maybe you have som errors there.

V-man
01-30-2006, 06:08 PM
Thanks.

I found the bug. The texture was not init at times due to my complex code.
By init, I mean glTexImage2D wasn't beeing called for the correct texture because glBindTexture needed a recall.

GLIntercept helps!
http://home.swiftdsl.com.au/~radlegend/GLIntercept/