PDA

View Full Version : Copy depth buffer to texture [SOLVED]



uto
01-14-2005, 06:54 PM
Hi, I missed something and I am starting to being nuts in some way...
I render a scene in the pbuffer which have a depth buffer, I create a texture with a GL_DEPTH_COMPONENT format, and one other with a GL_LUMINANCE format.
after rendering the scene I call

glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_depthTextureId);
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, m_width, m_height);to copy the depth buffer into the texture,
and I call


glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_luminanceTextureId);
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, m_width, m_height);to copy the frame buffer into the luminance texture.

Then I display both, the luminance is well setted, and I can see that the z test is well done, so that means that the depth buffer of the pbuffer works well. But the texture in which I copied the depth buffer is WHITE.

Please does anyone I have an idea, am I wrong somewhere ?
-Thanks,
-uto-