Jump to content
  • Advertisement
Sign in to follow this  
billconan

why disable the depth test will lead to erase the scene?

This topic is 4447 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 guys, i have a problem here the code is like this glClear(GL_COLOR_BUFFER_BIT); 1. draw something that needs gl depth test glDisable(GL_DEPTH_TEST); 2. draw something that does not need gl depth test glEnable(GL_DEPTH_TEST); but it turns out that only the 2. is drawn on the screen while the 1. seems to be erased. why? thank you.

Share this post


Link to post
Share on other sites
Advertisement
In your glClear, be sure to use GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT

That will make it erase the old depth data. Otherwise, even though you cleared the previous screen's colors, the depth data still says it's there, in front of or blocking the current scene.

I think that's your problem, but I'm not sure.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!