Jump to content
  • Advertisement
Sign in to follow this  
hannibal84

OpenGL Z-buffer seems to be drawing backwards....

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

Hey all, I'm a newbie to OpenGL, so bear with me here.... I'm making a maze program for my graphics class and I'm running into problems with the Z buffer (I think). All my walls and the ground draw, but it seems that if any polygons are supposed to be drawn "behind" another, the closer one will stop drawing at that point. For example, with closer walls in the maze, I can only see the top of the wall, while the wall behind it fills in the rest of the space. To see the current state of my maze, you can go to http://www.drewan.cc/openGL/maze.exe. Some of you might recognize the maze-creation algorithm from http://www.gamedev.net/reference/articles/article1637.asp (the objective of this program is not to demonstrate the capability to create a maze, but to demonstrate understanding of the camera). For controls, use the arrow keys. Keys 1-9 adjust the camera independently, modifying the 9 glLookAt parameters individually (hold shift to go the other way). If anyone could let me know where I am going wrong with this, I would greatly appreciate it. If all else fails, I'll just remove the floor and turn all the walls a single solid color again, so you can't tell the difference between a close wall and a near wall. =D Edit: Oops, my bad, uploaded the wrong version of the maze....

Share this post


Link to post
Share on other sites
Advertisement
a screenshot would be more helpful, usually dont download programs like these from the net. My guess is that you are setting your near and far plane too far apart, try bringing the far plane closer or pushing the near plane back. The ratio between them should be no more than 1000.

HTH

Share this post


Link to post
Share on other sites
I just tried playing with the near and far planes and that seemed to work. Thanks!

Here's my confusion, though.... The near plane was set to -10, the far to +10, and the scale I use for each "square" of the maze is 100x100. So why is it that when I switched the near plane to +10 and the far plane to -10, it showed up correctly? Is it just me, or does this sound backwards?

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!