Jump to content
  • Advertisement
Sign in to follow this  
Boder

OpenGL near/far screwy docs, confusion

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

The docs are definitely messed up here. For gluOrtho2D() I have found three conflicting descriptions for the near/far clipping planes. As follows: * (-1,1) <- Python OpenGL * ( 0,1) * ( 1,1) <- I think MSDN is wrong But aren't negative values always behind you and thus not shown? And I thought a near plane of 0 caused problems in the formulas? In the end, the values are mapped non-linearly into the range [0,1] inclusive before being written into the z-buffer, correct?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Boder
The docs are definitely messed up here.

For gluOrtho2D() I have found three conflicting descriptions for the near/far clipping planes. As follows:

* (-1,1) <- Python OpenGL
* ( 0,1)
* ( 1,1) <- I think MSDN is wrong

But aren't negative values always behind you and thus not shown?
And I thought a near plane of 0 caused problems in the formulas?

In the end, the values are mapped non-linearly into the range [0,1] inclusive before being written into the z-buffer, correct?


Well my books all say -1.0, 1.0. So when you are drawing your objects use glVertex2f() or if you use glVertex3f() make sure your z = 0.0 and when you translate on z if you move negative e.g. glTranslatef(0.0f, 0.0f, -1.0f) you will move the object back one, and the Z axis is looking down the negative value. I think you are right on the zero plane value, but gluOrtho2D() isn't 0.0. And the values are mapped non-linearly into the depth buffer.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Boder
But aren't negative values always behind you and thus not shown?
And I thought a near plane of 0 caused problems in the formulas?

Not with orthographic projections. Both of these are problems with perspective because: in the first case, you need an center of projection for perspective projection to make sense, and zero is a logical choice for such a center. In the latter case, this is a problem in perspective projection because you will get a divide by zero. Neither of these two things matter in orthographic projections. You can use any range of near/far that you want.

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!