View Full Version : Extracting z coordinate from z buffer
07-07-2003, 08:58 AM
Is it possible to extract the z coordinate of a fragment from the information stored in the z buffer?
If yes, is this solution portable amongst desktop graphics accelerators and hi-end workstations?
07-07-2003, 11:44 PM
1.) Yes, glReadPixels with GL_DEPTH_COMPONENT.
2.) Yes, this is a standard OpenGL method. The performance may vary among implementations.
07-08-2003, 09:02 AM
Ok. So far so good. Now I need to convert the z information extracted from the z buffer back to camera space. How can I do that?
07-08-2003, 09:08 AM
Does gluUnproject() do what you want?
Or have I missed the point.... http://www.opengl.org/discussion_boards/ubb/smile.gif
07-09-2003, 12:03 AM
Originally posted by camelo:
Now I need to convert the z information extracted from the z buffer back to camera space.
Haven't tried that myself, but I've heard people say that even though the data in the z-buffer are depth values it might not be that easy to map them back to camera space.To my knowledge OpenGL doesn't specify what format the depth values are stored in, it is implementation specific.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.