PDA

View Full Version : find the diferences!



KeSh
05-16-2004, 06:10 AM
This is probably a silly question but i would like a more precise distinction between these functions:

gluLookat()
gluPerspective()
glFrustum()
glOrtho()

Thanks in advance

mikael_aronsson
05-16-2004, 06:36 AM
Hi !

To get a full description of those function and all the other I suggest you have a look at the OpenGL spec. you can find it at this website, it explains all the details and is pretty easy to understand to. This together with some tutorials (can also be found here or with google) would give you a pretty good start.

Mikael

ioquan
05-16-2004, 07:20 AM
gluPerspective, glOrtho, and glFrustum all modify the _projection matrix_. The projection matrix transforms eye coordinates into screen coordinates. glFrustum gives you a perspective projection, which makes things look as they do in real life (objects appear smaller as they get further away). gluPerspective actually calls glFrustum internally. gluPerspective provides you with an easier way to set up a viewing frustum. glOrtho sets up a parallel projection, meaning that objects appear the same size when they are far away as they do when they are close. Orthographic projection is used in many 3D modellers for the 3 non-perspective views. Orthographic projection is also used for drawing 2D graphics in OpenGL, since it allows you to map world coordinates directly to screen coordinates.

Finally, gluLookAt is different from the others, because it modifies the _modelview matrix_, not the projection matrix. gluLookAt is supposed to give you an easy way of orienting your "camera".