Sign in to follow this  
Lasse__

Way to get current depthbuffer value for given pixel?

Recommended Posts

Lasse__    122
How can I query OpenGL to give depthbuffer value for pixel (x,y) in the screen? When I compare this depthbuffer value to another value obtained through gluProject(), the bigger the value the deeper in the screen, right?

Share this post


Link to post
Share on other sites
vincoof    514
Quote:
Original post by Lasse__
How can I query OpenGL to give depthbuffer value for pixel (x,y) in the screen? When I compare this depthbuffer value to another value obtained through gluProject(), the bigger the value the deeper in the screen, right?

Right, 0 representing the near clipping plane and 1 representing the far clipping plane. Note that in perspective projection, interpolated values are not linear ; for instance 0.5 does not represent 0.5*(far+near).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this