It’s a pretty simple question really:
When I use glFrustum is doesn’t work. When I use gluPerspective, it does. Why?
What is it that gluPerspective actually does to set the left, right, top and bottom clipping planes…
We know very very trivally, that the near distance defines the projection plane, so basically your FOV is:
FOV1 = 2 * atan(((top-bottom)/(near2.0))
FOV2 = 2 * atan(((right-left)/(near2.0))
Or rather, in the reverse:
top-bottom = tan(FOV1/2) * (near2.0)
left-right = tan(FOV2/2) * (near2.0)
However, using these forumla to generate the
left/right/top/bottom values from a near (far
is irrelevant) generates a perspective
transformation that has very small clipping
planes, and doesn’t seem to work at all.
Using gluPerspective to generate these
somehow make everything OK; and I don’t know
why.
In fact, nobody I’ve talked to so far really
seems to understand glFrustum at all; they
know the basics (above) but use
gluPerspective “because it works”.
Any ideas people? It can’t be that
complicated, can it? I know gluPerspective
generates the matrix to use directly… I’m
looking for justification for why it
generates that matrix.
cheers,
Doug.