Sign in to follow this  
billconan

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

Recommended Posts

billconan    200
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
nagromo    676
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

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