FBO, sharing render buffers

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?

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.

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.

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.

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/