How to render depth image for a 3D model ?


I used glReadPixels(0, 0, winw, winh, GL_DEPTH_COMPONENT, GL_FLOAT, zData);

but failed.

Does anyone can provide source code for this function?

thanks so much.

Explain “failed” - did it error or was the data all zeros?

thanks for your reply. This is the output image:

It seems the output image is not the depth image. The correct image should be a depth image of plane in the middle of the image.