PDA

View Full Version : How do I obtain the projection matrix and the depth value?



ZhugeLiang
08-17-2000, 07:22 AM
I want to know the projection matrix and the depth value in each pixel.

And I will solve the 3D coordinate value in the real axis.

But I don't know the function that can return the projection matrix

and the depth value.

Thanks in advance...

Kilam Malik
08-17-2000, 08:03 AM
GLdouble projMatrix[16];

glGetDoublev(GL_PROJECTION_MATRIX,projMatrix);

returns you the projection matrix.




glFloat pixels;

glReadPixels(x,y,1,1,GL_DEPTH_COMPONENT,GL_FLOAT,& pixels);

gives you the z value at a specific 2D point on screen.

Kilam.