Chapter 4
OpenGL Programming
4.1
Introduction
This chapter describes features of the OpenGL library - a 3D graphics programming library
that enables you to create high performance graphics applications using the mathematics covered on this course.
Like al

EVD: GRAPHICS APPLICATIONS (CM20219)
J. P. Collomosse
and so on. Figure 5.5 illustrates.
Thus we see that the Eigenmodel not only represents the average of the training data, but
also the principal directions in which it varies and how much variation ther

IMAGE REPRESENTATION (CM20219)
J. P. Collomosse
Bright Red and Bright Green that we wish to mix in equal parts e.g. in a photo editing
package. In RGB space these colours are (255, 0, 0) and (0, 255, 0) respectively. In HSV space
these colours are (0 , 1,

MATHEMATICAL BACKGROUND (CM20219)
J. P. Collomosse
The identity matrix leads us to a denition of the inverse of a matrix, which we write
A1 . The inverse of a matrix, when pre- or post-multiplied by its original matrix, gives the
identity:
AA+ 1 = A1 A =

IMAGE REPRESENTATION (CM20219)
J. P. Collomosse
Figure 2.3: Left: Sketching the response of each of the three cones to diering wavelengths
of light. Peaks are observed around the colours we refer to as Red, Green and Blue. Observe
the secondary response o

Chapter 1
Mathematical Background
1.1
Introduction
The taught material in this course draws upon a mathematical background in linear algebra.
We briey revise some of the basics here, before beginning the course material in Chapter 2.
1.2
Points, Vectors a

GEOMETRIC TRANSFORMATION (CM20219)
J. P. Collomosse
Figure 3.8: A spinning 3D cube is animated by manipulating its position in space using 3D
rigid body transformations (4 4 matrix transforms), and projected on the 2D screen using
the perspective projecti

GEOMETRIC MODELLING
J. P. Collomosse
Figure 6.1: The explicit, parametric and implicit forms of a line.
So suppose we want to model a line, any line, in our Computer Graphics system. An alternative way to do this is to using the parametric form:
p(s) = x0

GEOMETRIC TRANSFORMATION (CM20219)
J. P. Collomosse
framework of linear transformations, i.e. in general we resort to the messy form of a
multiplication and an addition for translations:
p = M p + t
(3.13)
Fortunately there is a solution; we can write tra

EVD: GRAPHICS APPLICATIONS (CM20219)
J. P. Collomosse
Figure 5.2: Illustrating a simple intensity classication approach to detecting sky. Left:
Source greyscale image; pixels used to train model marked in green (mean intensity was 175).
Middle: Classicati

GEOMETRIC TRANSFORMATION (CM20219)
J. P. Collomosse
Figure 3.5: Illustrating the rotation of a point about an arbitrary axis in 3D to be read in
conjunction with the description in subsection 3.3.2. The gure assumes the axis of rotation
(L) already passes

OPENGL PROGRAMMING (CM20219)
J. P. Collomosse
inside GLUT - and thus triggers a callback to display(.) - which draws the teapot at
a new angle.
In this case the counter is simply used as an input to glRotate to create a spinning teapot, but
more complex e