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: