Jump to content
  • Advertisement
Sign in to follow this  
O-san

OpenGL OpenGL Z-buffer

This topic is 4081 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I'm wondering if it is possible to calculate the z-buffer value of a pixel if I know that the point lies on the same plane as another known x,y,z position. The picture illustrates the problem better: I'm interested in the z value of the red dot. I can't use glReadPixels. Any help appreciated!

Share this post


Link to post
Share on other sites
Advertisement
the pixel with the black dot, is it in worldspace coordinates or eyespace?

btw you can calculate the z buffer value using the modelviewprojection matrix

modelview transforms from object to world space
and the projection view matrix from worldspace to eyespace

Share this post


Link to post
Share on other sites
Well, you could get two other points on that plane to get the scalar equation of that plane (assuming you don't already have it), and use that equation to find your z value. If you have the normal to the plane already, then your job is even easier. This would be independent of opengl, but it should work fine.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!