Rendering the content of depthbuffer

Hi all.

I have a pretty anoying problem that Im struggling with.

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

I have the FPO rendering to Colorbuffer working.
I can render a scene to a texture and bind it to a screen aligned quad, works just fine.
But when I trying to do the same thing with the depth-buffer texture, its black.

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,
0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);

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:

http://www.vrlab.umu.se/tmp/helloGPGPU_GLSL.cpp

There could have some bad surprises when using FBO for getting back the depth buffer. Have a look at the specs, then if it’s still not working, have a search on the advanced forums.
I personally need a color buffer attached along with a depth-renderbuffer and it works.

Do you have a working example?
Because Im using a colorbuffer together with a depth buffer, so it should work…

Don’t you need to set these if you want to view the texture?

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE);