PDA

View Full Version : Strange FBO+ATI+depth problem



Sansus
12-12-2006, 08:52 AM
How is it possible this code gives me a n incomplete fbo?


GLuint fb, rtt, depth_rb, depth_stencil_rb;
glGenFramebuffersEXT(1,&fb);
glGenTextures(1,&rtt);

glBindTexture(GL_TEXTURE_2D,rtt); glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT16, t->GetWidth(),t->GetHeight(),0,GL_DEPTH_COMPONENT,GL_UNSIGNED_BYTE, NULL);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_DE PTH_ATTACHMENT_EXT,GL_TEXTURE_2D,rtt,0);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);


GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
switch(status)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
throw sandra::error::RenderToTexture("Framebuffer object mode unssupported!");
break;
default: /* programming error; will fail on all hardware */
assert(0);
} It runs as expected on nvidia harware.

k_szczech
12-12-2006, 10:36 AM
I'm not sure about this, but I think some Radeons don't support depth-only FBO's, so you need a color attachment.
I have an NVIDIA so I cannot confirm this.
Besides, your code does not check for GL_FRAMEBUFFER_INCOMPLETE_EXT - you have default option in your case block, but you should actually add separate option.
There3 are also some limitations on NVIDIA - if you need stencil then you should use packed_depth_stencil if available.

hseb
12-12-2006, 11:55 PM
With old ATI driver, you must declare depth buffer as a render buffer and not a texture... I don't know if it works now...

On nVidia, it works with render buffer and texture.

k_szczech
12-13-2006, 12:52 AM
With old ATI driver, you must declare depth buffer as a render buffer and not a textureYeah - that's what I heard. Sorry, looks like I mixed it up in my previous post when I wrote you need color attachment.

Sansus
12-13-2006, 05:38 AM
I have installed the latest ATI drivers but it didn't resolv my problem. Thus, if you are right and ATI drivers doesn't allow to attach a depth buffer as a texture.... how the hell do I perform an optimal shadowmapping algorithm using FBO?

k_szczech
12-13-2006, 06:27 AM
how the hell do I perform an optimal shadowmapping algorithm using FBORender to texture if supported and copy to texture if not. Your application will probably work a bit faster on NVIDIA, but perhaps NVIDIA deserved it in this case :)

Sansus
12-13-2006, 07:34 AM
Ok. But I can't understand how ATI drivers lack this feature being so important shdowmapping in these days.