Camera
The default camera position is at the origin pointed in the -z direction. We can, however, change
this position and orientation with the command
gluLookAt(eyex, eyey, eyez, atx, aty, atz, upx,
Both user interaction and animation utilize the event driven nature of the operating
system. Fortunately, GLUT has taken care of wrapping this functionality into callback
routines that are relatively
All vertices passed into the graphics card are processed by a multi-stage graphics pipeline. The
graphics pipeline is optimized to process graphics (as opposed to a more general purpose
computing pipe
The simplest type of projection is known as orthographic, often used in engineering drawings. In
this projection mode, the camera is assumed to be at an infinite distance, i.e. at +|infin| looking in
Defining Geometry through Vertices
All objects in OpenGL are created through a set of polygons that are defined by the coordinates
of the corner vertices. The vertices are passed to the graphics pipel
Mouse Input
Mouse input is handled by two mouse callbacks, the mouse clicked callback and the mouse
motion callback. The mouse clicked callback is called when a mouse button is pressed or
released and
Orthographic Projection and the Reshape Callback
Often it is convienient to define the geometry of the objects in our world without having to scale
everything to fit within the default extents of [-1,
Vector/Matrix Operations
Addition
Addition is done componentwise for vectors/matricies that have the same dimensions. Hence
adding two vectors
would give
Similarly, adding matrices
would give
However
Conceptually, translation is simply a matter of adding the desired offsets to the components of
each vertex. Unfortunately the graphics pipeline is optimized to perform multiplication and
hence would
Spherical Coordinates
We have already discussed in previous labs how to reset the modelview matrix
using glLoadIdentity(). However often we wish to maintain a global transformation, e.g. one
produced
Perspective Projection
Unlike orthogonal projection where parallel lines remain parallel and the size of an object is
independent of its location relative to the camera, perspective projection is more
Scaling Transformations
The simplest transformations to apply are scaling transformations which simply multiply each
component of a vector by a given amount known as the scale factor. If the scale fac