Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Nehe Lesson 32 - Depth Bug?

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

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