Jump to content
  • Advertisement
Sign in to follow this  
Sir Sapo

OpenGL Setting Draw Distance

This topic is 4973 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 guys, I was just wondering , how do you set the draw distance for OpenGL? Is it somewhere in the initialization code?

Share this post


Link to post
Share on other sites
Advertisement
draw distance?
If you mean the far clipping plane it can be set with calls to either glFrustum() or gluPerspective() functions for perspective based drawing, or if 2D drawing is what you want then its either glOrtho() or gluOrtho2D() (pgs 127 and onwards in the Red Book)
Yes, this is generally done at startup unless you need to switch from 3D to 2D and back during program run then it will be done as you need it.
These calls should operate on the GL_PROJECTION matrix.

Share this post


Link to post
Share on other sites
Also note that you may some form of fogging in your scene as well because otherwise when things get clipped by the far plane of the view frustum (i.e. they are beyond the draw distance) it'll look a bit odd. You can use fog so that objects near the far plane are pretty much obscured and the clipping can't be noticed.

Share this post


Link to post
Share on other sites
also if you use the z-buffer you should use glEnable(GL_DEPTH_TEST); to draw the objects by order

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!