View Full Version : The frustrating glFrustum
Can anyone explain to me how should a newbie setup a perspective view using glFrustum?
I'm trying to do a program where I render a cube with orthographic and perspective projections (doing it separately, of course) but unfortunatelly my cube keeps on looking extremelly distorted when I use perspective projection.
Thanks in advance
04-14-2003, 04:46 PM
Try using gluPerspective instead... much simpler.
Thanks for the advice. Using gluPerspective is indeed simpler to use than glFrustum.
But, unfortunatelly, I'm trying to learn how to set a perspective view using glFrustum and I believe gluPerspective won't help me with that :\
But thanks for your help anyway.
Have you got a copy of the OpenGL Programming Guide (aka Redbook)? That gives a pretty good description of frustums. The earlier versions of the book are now freely available all over the place - search Google for +"redbook.pdf" +OpenGL.
Frustums aren't that hard to visualise, but are very hard to get right! The process can be explained to you, but it's probably better to look at the redbook, as it has pictures and such! http://www.opengl.org/discussion_boards/ubb/smile.gif
04-15-2003, 04:57 AM
I'll attempt a bit of an explanation of glFrustum.
For the moment, just think about the near clip plane. You can think of it as drawing a pyramid where the top of the pyramid is the eye point, and the bottom of the pyramid is the near clip plane.
Now consider that you set your left/right bottom/top parameters fairly large, but you have a small near value. That is going to result in a very short pyramid where the angles are very large. These angles can be thought of as your field of view. A large field of view is going to cause distortion.
Now picture that you extend the sides of your pyramid to extend to the far clip plane, keeping the angle the same. Chop it off where the near clip plane was and you have the shape of your frustum.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.