Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

kadaf

OpenGL reading the zbuffer in OpenGL

This topic is 6680 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

how do i read the zvalue of a specific pixel, from the zbuffer. I have to use that to determine if a lens flare should be visible or not. thanks -------------------- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Rasmus Neckelmann mullen@forum.dk zimgames.cjb.net

Share this post


Link to post
Share on other sites
Advertisement
Use glReadPixels(x,y,width/*1*/,height/*1*/,GL_DEPTH_COMPONENT,GL_UNSIGNED_INT,&my_long);

The depth value will be in the variable my_long.

Visit our site: www.rarebyte.de.st

GA @ Rarebyte

Share this post


Link to post
Share on other sites
BTW you could use other OpenGL data type constants instead of GL_UNSIGNED_INT:
GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_INT, GL_FLOAT

GL_FLOAT does not have a higher precision than GL_UNSIGNED_INT, because they''re both 32 bits

GA

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites

  • 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!