Sign in to follow this  
shinyflute

OpenGL Nehe Lesson 32 - Depth Bug?

Recommended Posts

In Hehe's OpenGL lessons 32, lesson32.cpp 1. Change the following code objects object[30];// Storage For 30 Objects to objects object[300]; 2. Change the following code GLint level=1; // Current Level to GLint level=250; 3. Compile & Start the game 4. When there are much more objects on the screen, it's possible to occur that one object cover another one (they have different z-coord) However, Nehe's follwing code which deals with this program seems not working properly: for (int loop = 1; loop < hits; loop++) // Loop Through All The Detected Hits { // If This Object Is Closer To Us Than The One We Have Selected if (buffer[loop*4+1] < GLuint(depth)) { choose = buffer[loop*4+3]; // Select The Closer Object depth = buffer[loop*4+1]; // Store How Far Away It Is } } In my computer (WinXP), buffer[loop*4+1] are all zero. I do not know why. Can anyone help me? Thanks.

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