Jump to content
  • Advertisement
Sign in to follow this  
ogl5

OpenGL depth buffer

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

I was wondering if there is an easy way to make OpenGL only write to the depth buffer for non-transparent pixels. For instance, if you draw a quad with a picture of a tree, and parts of the quad are transparent, those parts will still affect the depth buffer even though they're transparent. I don't want the depth buffer affected by transparent pixels.

Share this post


Link to post
Share on other sites
Advertisement
Hello,

I believe you are looking for the glDepthMask(GL_FALSE) command. You should use it while rendering the transparent objects and deactivate it while rendering your other geometry. Remember that you have to render your non-transparent geometry first and then your transparent geometry. You also have to sort your transparent geometry if you want them to render entirely correct.

Hope I've been able to help,
Jeroen

Share this post


Link to post
Share on other sites
Quote:
Original post by ogl5
I was wondering if there is an easy way to make OpenGL only write
to the depth buffer for non-transparent pixels.
Alpha test

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!