PDA

View Full Version : gluPerspective VS. glFrustum !!!!!



ByteZero
11-11-2001, 09:01 PM
Hi

I'am a little confused, I want to know what I should using for creating a Clipping Volumen, I mean does glFrustum do not the same like gluPerspecitve both creating a Perspective Matrix.
What are the advantages and disadvantages of these both routines ????

mikael_aronsson
11-11-2001, 09:44 PM
From the OpenGL FAQ:

"9.080 What are the pros and cons of using glFrustum() versus gluPerspective()? Why would I want to use one over the other?

glFrustum() and gluPerspective() both produce perspective projection matrices that you can use to transform from eye coordinate space to clip coordinate space. The primary difference between the two is that glFrustum() is more general and allows off-axis projections, while gluPerspective() only produces symmetrical (on-axis) projections. Indeed, you can use glFrustum() to implement gluPerspective(). However, aside from the layering of function calls that is a natural part of the GLU interface, there is no performance advantage to using matrices generated by glFrustum() over gluPerspective().

Since glFrustum() is more general than gluPerspective(), you can use it in cases when gluPerspective() can't be used. Some examples include projection shadows, tiled renderings, and stereo views.

Tiled rendering uses multiple off-axis projections to render different sections of a scene. The results are assembled into one large image array to produce the final image. This is often necessary when the desired dimensions of the final rendering exceed the OpenGL implementation's maximum viewport size.

In a stereo view, two renderings of the same scene are done with the view location slightly shifted. Since the view axis is right between the “eyes”, each view must use a slightly off-axis projection to either side to achieve correct visual results."


Mikael

ByteZero
11-11-2001, 10:04 PM
Thanks mikael for clearing me up.