The modelling transformation expresses the position of objects in the
world. We derive the viewing transformation by first expressing the position
of the camera in the world. This transformation is then inverted to express
the position of the world with respect to the camera.
![]()
Defining McamA common way of defining the camera position and orientation is to use:
![]() Building M_camThe vectors i,j,k can be determined as follows:![]()
These vectors can then be used to form a change-of-basis matrix, which is composed with a translation to yield the camera-to-world transformation and its inverse, which is what we really desire. Positioning the camera in OpenGLThe OpenGL auxilliary library provides the call gluLookAt() to create the viewing transformation.gluLookAt(ex,ey,ez,rx,ry,rz,ux,uy,uz> where (ex,ey,ez) gives the eye point,
(rx,ry,rz) gives
the reference or 'lookat' point, and
(ux,uy,uz) gives the up vector.
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(ex,ey,ez,rx,ry,rz,ux,uy,uz); /* setup modelling transformations here */ |
Hosted by Graphics & Media Lab
http://graphics.cs.msu.su |
![]() |
mailto: Laboratory |