Sign in to follow this  
nerdtron

glOrtho vs. glFrustum

Recommended Posts

My understanding is that with glOrtho, the near and far values are relative to the origin. I say this because the docs indicate that if near or far is negative then they're the behind you and if they're positive they're in front. So relative to the origin, you're specifying the distance and direction (+/-) to the near and far planes which define the viewing volume. The docs for glFrustum, however, indicate that both near and far must be positive. So where is the origin with glFrustum? Is the eye point at the origin and the viewing volume out in front? Or is it assumed that the near and far planes are centered about the origin? I'm leaning to the eye point being at the origin as it seems with the other way there'd be no way for the fov to be computed.

Share this post


Link to post
Share on other sites
With glOrtho it is not important if clipping planes are in front of behind the origin (where the eye is) because it is not a perspective projection and projector rays are parallel.

glFrustum requires positive values for both clipping planes distances (those are distances from the eye), and the eye is at the origin (where projector rays intersect each other).

Share this post


Link to post
Share on other sites
so from what you're saying, then, with glFrustum, the eye is at the origin of the view coordinate system looking toward the near and then far planes which are placed at distances away from the eye. as opposed to glOrtho where you're just setting up planes all relative to the origin and including everything in that volume.

any advice on converting from glOrtho to glFrustum? I already have glOrtho setup and working and I'd like to include (roughly) the same size and objects in the view (I understand the viewing volume will be shaped differently), I just want the perspective effect so that objects farther away are smaller, etc.

I tried creating a frustum shaped viewing volume to match my ortho viewimg volume where the size in the xy plane (left,right,top,bottom) matched at the near plane in the frustum. So, given a fov, I compued the near and far planes such that the near plane would be the same size as the ortho viewing volume.

I end up getting everything looking too small.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this