View Full Version : FBO Problems when rendering depthbuffer, visually

01-02-2006, 10:33 AM
Hi all.

I have a pretty anoying problem that Im struggling with.

Im trying to use FBO:s to render Colorbuffer and depthbuffer to two separate textures.

Then Im binding the depth texture to render it visually to the screen, but its just black.
If I bind and use the Colorbuffer-texture it looks ok.
To start from something that worked, I downloaded the helloGPGPU_GLSL_FBO example from the GPGPU site. (also available from sourceforce as fboClass)

I have modified the texture target for the depth buffer to become a
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, _iWidth, _iHeight,

Also, attaching that texture to DEPTH_ATTACHMENT_EXT such as:

_fbo.AttachTexture(GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, _iTexture[1]);

Then Im just skipping the GLSL stuff to directly view the result. The code is below...

Now, all I get is black.
Is there something I have to do to actually render a GL_DEPTH_COMPONENT/GL_FLOAT texture so that it becomes visible?

Thanks for any input.
the code can be found at: