Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

David Jones

Z-buffer problems

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

My depth testing was definately not working in my Open GL program, so I decided to look through these forums. Quite a while ago someone had something similar. I now understand where I went wrong and wish to share it. When setting the perspective matrix - gluPerspective (angle, (w/h), near, far); - is where my problem occured. The Z-buffer uses a ratio to determine how much to focus in certain areas...there''s some fact like 98% of the depth buffer is used on the first 2% of the scene. I had the near set as 0.0f, which obviously caused a divide by zero and therefore the buffer wouldn''t work. The other guy was using 0.5f...very similar, it makes the ratio huge! Hope this helps someone! It''''s always a silly little error!

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by _Corrupt_
it is also advised to make znear at least 1.0f


Not nessecarily... It is advised that you keep the ratio between your znear, and zfar small... Some people use 0.1f, 1000.0f, and that is a very large ratio, which will cause problems on some cards. So what you can do is just change the near to 1.0f...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!