PDA

View Full Version : Yet another FBO question



Zulfiqar Malik
06-29-2005, 09:45 AM
Hardware: GFX 5900 XT
Driver: 77.72 w/ FBO support

Ok, the problem is that i am using FBO for a certain dynamic texture. As far as the color part of the RT goes, it gets rendered fine in GL_COLOR_ATTACHMENT0_EXT. However, since i need z-buffering also therefore i create a "render buffer" with depth component 24 (or 16, doesn't matter). But when i try to attach this render buffer to the FBO i get an error suggesting that the format is unsupported! However, if i use a depth texture (GL_DEPTH_COMPONENT) as a z-buffer and attach it to the FBO, everything works fine and i get proper depth buffering.

I would also like to know whether i can use the default depth buffer instead of creating one with each FBO that requires depth buffering?

Thanks in advance.

M/\dm/\n
06-29-2005, 11:11 AM
glGenRenderbuffers(1, &rb_dcm);
glBindRenderbuffer(GL_RENDERBUFFER_EXT, rb_dcm);
glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, dyn_cm_size, dyn_cm_size);
glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0);

glGenFramebuffers(1, &fb_dcm);
glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb_dcm);
glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);+ some texture setup...

Zulfiqar Malik
06-29-2005, 09:39 PM
Thats exactly what i am doing! But when i try to attach the depth render buffer with the FBO it gives me an unsupported error report!

Any comments on using the "default" depth buffer in case you don't want to create a seperate one (or share) for each FBO?

M/\dm/\n
06-30-2005, 03:02 AM
Dunno, my program works just fine (FW77.72), and it does depth renderbuffer sharing too...

Do you bind texture to color buffer? I didn't included snippet for that...

Zulfiqar Malik
06-30-2005, 07:06 AM
Yes i do, and i have even matched my code with the FBO presentation on nVidia's website and everything seems to be in order.

Btw, i think that binding a depth render buffer is irrelavent to binding a color texture target with FBO, since you could be doing depth only rendering too e.g. shadow maps. Any idea when ATI plans on making their OpenGL drivers upto date and less buggy, in case they haven't totally dumped opengl altogether :) . nVidia is very aggressive in providing latest extension support in their driver and ATI is really ignoring the OpenGL community (thats just my feeling). Its time they put their act together!

Thanks for the help though.

M/\dm/\n
07-01-2005, 12:29 AM
Search this forum, there was a FBO demo using depth and color buffers, working example might help you better.