Section 3.
Shapes and Colors in OpenGL 1.1
unsigned byte
A data type representing 8-bit non-negative integer values, taking values in the range from 0
to 255.
interpolation
Given values for some quantity at certain reference points, computing a value for that
quantity at other points by some kind of averaging applied to the values at the reference points.
color buffer
In OpenGL, the region of memory that holds the color data for the image. It acts as the
drawing surface where images are rendered.
JOGL
A Java implementation of OpenGL. JOGL is very complicated, since it attempts to support
all versions of OpenGL in one programming system. JOGL integrates seamlessly with Java's
Swing and AWT graphics.
hidden surface problem
The problem in 3D graphics of deciding which object is visible at each pixel in an image.
When one object is behind another object from the point of view of the viewer, only the front
object should appear in the image. A rendering algorithm for 3D graphics must satisfy this
constraint. Algorithms that solve the hidden surface problem include the painter's algorithm and
the depth test algorithm.
painter's algorithm
A solution to the hidden surface algorithm that involves drawing the objects in a scene in
order from back to front, that is, in decreasing order of distance from the viewer. A disadvantage
is that the order is usually not well-defined unless some objects are decomposed into smaller
sub-objects. Another issue is that the order of drawing has to change when objects move or when
the point of view changes.
depth test
A solution to the hidden surface problem that involves keeping track of the depth, or distance
from the viewer, of the object currently visible at each pixel in the image. When a new object is
drawn at a pixel, the depth of the new object is compared to the depth of the current object to
decide which one is closer to the viewer. The advantage of the depth test is that objects can be
rendered in any order. A disadvantage is that only a limited range of depths can be represented in
the image.
depth buffer
A region of memory that stores the information needed for the depth test in 3D graphics, that
is, a depth value for each pixel in the image. Also called the "z-buffer."
Section 3.2
3D Coordinates and Transforms
right-handed coordinate system
A coordinate system on 3D space in which the x, y, and z-axes satisfy this property: If you
point the thumb of your right hand in the direction of the positive z-axis, then your fingers will
curl from the positive x-axis towards the positive y-axis.
eye coordinates
The coordinate system on 3D space defined by the viewer. In eye coordinates in OpenGL
1.1, the viewer is located at the origin, looking in the direction of the negative z-axis, with the
positive y-axis pointing upwards, and the positive x-axis pointing to the right. The modelview
transformation maps objects into the eye coordinate system, and the projection transform maps
eye coordinates to clip coordinates.
axis of rotation
Rotation in 3D space is rotation about a line, which is called the axis of rotation. The axis of
rotation remains fixed, while everything else moves in circles around the axis.
right-hand rule
A rule that is used to determine the positive direction of rotation about an axis in 3D space: If
you point the thumb of your right hand in the direction of the axis, then your fingers will curl in
the direction of positive angles of rotation. Note that this assumes that the axis has a direction; in
OpenGL, an axis of rotation is determined by the point (0,0,0) and another point (x,y,z), and the
direction of the axis is from (0,0,0) towards (x,y,z).
Section 3.3
Projection and Viewing
viewing transformation
The transformation in 3D graphics that maps world coordinates to eye coordinates. The
viewing transform establishes the position, orientation, and scale of the viewer in the world.
modelview transformation
In OpenGL 1.1, a transform that combines the modeling transform with the viewing
transform. That is, it is the composition of the transformation from object coordinates to world
coordinates and the transformation from world coordinates to eye coordinates. Because of the
equivalence between modeling and viewing transformations, world coordinates are not really
meaningful for OpenGL, and only the combined transformation is tracked.
view volume
In OpenGL 1.1, the region is 3D space that is visible in the rendered image. For orthographic
projections, the view volume is a rectangular solid. For perspective projection, the view volume
is a frustum (truncated pyramid).
clip coordinates
The default coordinate system in OpenGL. The projection transform maps the 3D scene to
clip coordinates. The rendered image will show the contents of the cube in the clip coordinate
system that contains x, y, and z values in the range from -1 to 1; anything outside that range is
"clipped" away.
projection transformation
In 3D graphics, a transformation that maps a scene in 3D space onto a 2D image. In OpenGL
1.1, the projection maps the view volume (that is, the region in 3D space that is visible in the
image) to clip coordinates, in which the values of x, y, and z range from -1 to 1. The x- and y-
coordinates are then mapped to the image, while the z coordinate provides depth information.
device coordinates
The coordinate system used on a display device or rendered image, often using pixels as the
unit of measure.
viewport transformation
In OpenGL 1.1, the final transformation from clip coordinates to device coordinates. The
viewport transformation maps the clipping cube (the cube in 3D given by x, y, and z coordinates
in the range from -1 to 1) to the viewport (the rectangle in the drawing surface where the image
is rendered).
GLUT
The OpenGL Utility Toolkit. A platform-independent library for writing OpenGL
applications. OpenGL does not include support for windows or events. GLUT adds such support.
It also has functions for drawing 3D shapes such as spheres and polyhedra (not to mention a
teapot). GLUT is written in the C programming language and is used with the C API for
OpenGL. However, many GLUT functions are also available in JOGL, the Java API for
OpenGL. A newer, and somewhat improved, version of the toolkit named "FreeGLUT" is
commonly used in place of the original version.
matrix mode
In OpenGL 1.1, a state variable that determines which one of several transformation matrices
will be affected by functions such as glRotatef and glFrustum. The matrix mode is set with the
function glMatrixMode. Possible values include GL_MODELVIEW, GL_PROJECTION, and
GL_TEXTURE.
perspective projection
A projection from 3D to 2D that projects objects along lines radiating out from a viewpoint.
A perspective projection attempts to simulate realistic viewing. A perspective projection
preserves perspective; that is, objects that are farther from the viewpoint are smaller in the
projection. In OpenGL 1.1, the view volume for a perspective projection is a frustum, or
truncated pyramid.
orthographic projection
A projection from 3D to 2D that simply discards the z-coordinate. It projects objects along
lines that are orthogonal (perpendicular) to the xy-plane. In OpenGL 1.1, the view volume for an
orthographic projection is a rectangular solid.
frustum
A truncated pyramid; that is, a pyramid from which the top has been cut off. In OpenGL 1.1,
the view volume for a perspective projection is a frustum.
camera
In 3D computer graphics, an object that combines the projection and viewing transforms into
an abstraction that imitates a physical camera or eye.
Section 3.4
Polygonal Meshes and glDrawArrays
polyhedron
A closed 3D figure whose faces, or sides, are polygons. Usually, it is assumed that the faces
of a polyhedron do not intersect, except along their edges.
polygonal mesh
A collection of polygons, where the polygons can be joined together along their edges. A
polygonal mesh can represent a polyhedron, or can be used as an approximation for a curved
surface. A polygonal mesh can be represented as an indexed face set.
indexed face set
(IFS). A data structure that represents a polyhedron or polygonal mesh. The data structure
includes a numbered list of vertices and a list of faces. A face is specified by listing the indices of
the vertices of the face; that is, a face is given as a list of numbers where each number is an index
into the list of vertices.
nio buffer
A Java object belonging to the class [Link] or one of its subclasses. Nio buffers are
similar to arrays, but they are optimized for input/output operations. Nio buffers are used instead
of arrays for certain purposes in Java's JOGL API for OpenGL.
Section 3.5
Some Linear Algebra
length of a vector
A vector is defined by its length and its direction, so length is a fundamental property. When
a vector is represented as an arrow, its length is just the length of that arrow. For a 2D vector
given by coordinates (x,y), the length is the square root of x*x+y*y. For a 3D vector given as
(x,y,z), the length is the square root of x*x+y*y+z*z.
norm of a vector
Another term for the length of the vector. For a 3D vector given as (x,y,z), the norm is the
square root of x*x+y*y+z*z.
unit vector
A vector of length one.
normalized vector
The result of dividing a non-zero vector by its length, giving a unit vector, that is, a vector of
length one. (Note that "normalized vector" and "normal vector" are, confusingly, unrelated
terms!)
scalar product
The product of a number and a vector. The scalar product of a number s and vector v is the
vector obtained by multiplying each coordinate of v by s. In 3D, if s is a number and v=(x,y,z),
then the scalar product of s times v is the vector (sx,sy,sz).
dot product
The dot product of two vectors is the sum of the products of corresponding coordinates. For
3D vectors v=(x,y,z) and w=(a,b,c), the dot product of v and w is x*a+y*b+z*c. The dot product
is equal to the cosine of the angle between the vectors, divided by the product of their lengths.
cross product
A vector product of two 3D vectors. The cross product of v and w is a vector that is
perpendicular to both v and w and whose length is equal to the absolute value of the sine of the
angle between v and w. If v=(x,y,z) and w=(a,b,c), then their cross product is the vector (yc-
zb,za-xc,xb-ya).
normal vector
A normal vector to a surface at a point on that surface is a vector that is perpendicular to the
surface at that point. Normal vectors to curves are defined similarly. Normal vectors are
important for lighting calculations.
unit normal
A normal vector of length one; that is, a unit vector that is perpendicular to a curve or surface
at a given point on the curve or surface.
identity matrix
The n-by-n identity matrix is an n-by-n matrix which has ones on the diagonal and zeros
elsewhere. Multiplication of any matrix B by the identity matrix, in either order, leaves B
unchanged. Multiplication of an n-dimensional vector by the n-by-n identity matrix leaves the
vector unchanged; that is, the identity matrix is the matrix for the identity transformation.
column-major order
Column-by-column ordering of the elements of a two-dimensional matrix; that is, an
ordering that starts with the elements in the first column, followed by the elements in the second
column, and so on. Column-major order is used for matrices in OpenGL and GLSL.
homogeneous coordinates
A way of representing n-dimensional vectors as (n+1)-dimensional vectors where two (n+1)
vectors represent the same n-dimensional vector if they differ by a scalar multiple. In 3D, for
example, if w is not zero, then the homogeneous coordinates (x,y,z,w) are equivalent to
homogeneous coordinates (x/w,y/w,z/w,1), since they differ by multiplication by the scalar w.
Both sets of coordinates represent the 3D vector (x/w,y/w,z/w)
Section 3.6
Using GLUT and JOGL
double buffering
A graphics technique in which an image is drawn off-screen, in a region of memory called an
off-screen buffer or "back buffer." When the image is drawn, it can be copied to the buffer that
represents the contents of the screen, which is also known as the "front buffer." In true double
buffering, the image doesn't have to be copied; instead, the buffers can be "swapped" so that the
back buffer becomes the front buffer, and the front buffer becomes the back buffer.
single buffering
As opposed to double buffering, a graphics technique in which the image is drawn directly to
the screen (that is, to the buffer that serves as the source for the screen image). The disadvantage
of single buffering is that, for a complex image, the user can observe the process of drawing the
image.
wireframe
A style of drawing a polyhedron or polygonal mesh in which only the edges are drawn,
resulting in an image made up of line segments.
DOM
Document Object Model. A specification for representing a web page (and other kinds of
structured document) as a tree-like data structure. Can also refer to the data structure itself, as in
"the DOM for this web page." A web page can be modified dynamically by manipulating its
DOM, using the JavaScript programming language.