How to render depth image for a 3D model ?

hi~

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: www.ihncs.com/thread-2733-1-1.html

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.