3 Review of Graphics Programming

"Computer graphics is concerned with all aspects of producing pictures or
images using a computer" [23]. Early computer systems used patterns of
illuminated bulbs or crude paper printouts to convey useful information to
computer users [36]. In 1950, the Whirlwind Computer, developed at MIT, had
computer-driven cathode ray tube (CRT) displays for output [25]. The term
'Computer Graphics' was later coined by William Fetter at Boeing in 1960 [27].
In 1963, Ivan Sutherland's Sketchpad became the first extensive interactive
drawing program [27] which contained many fundamental ideas and techniques that
are still in use in modern graphics packages [25].

Figure 3.1- Raster Graphics

A raster graphics image is a pixmap, a two-dimensional array of pixels.
Typically each pixel has a red, green and blue colour component, which when
combined, determine the colour of the pixel. A rastered image cannot be scaled
up without the apparent loss of quality [28].

Figure 3.2 - Vector Graphics

A vector graphics image uses geometrical primitives such as points, lines,
curves and polygons. Vector graphics allow objects to be drawn from a minimum
amount of information. Storing objects as a set of parameters allows them to be
moved, resized and rotated without any loss of quality [29].

In three-dimensional computer graphics, a synthetic camera model is often used,
where the "specification of objects is independent of the specification of
the viewer" [23].

Figure 3.3 - The Synthetic Camera Model
(Adapted from [23] and [24])

Three-dimensional objects are projected onto a two-dimensional projection plane
[25]. The image is determined by the location of the centre of projection (where
the image is to be viewed from), the location and orientation of the projection
plane, and the size of the clipping window (a rectangle used to restrict the
projection plane so that only objects whose projections are within this window
appear in the image [23].

In simple systems, the CPU handles all of the graphics processing. Most modern
systems have a special purpose graphics processor or graphics card which has an
instruction set designed to accelerate the display of three-dimensional
graphics.

Computer graphics displays mostly use raster techniques (Section 3.2), dividing
the screen into a rectangular grid of pixels. Pixels for display are stored in a
section of memory called the frame buffer. The resolution - the number of pixels
in the frame buffer - determines the quality of the raster image. The colour
depth of the frame buffer - the number of bits used for each pixel - determines
how many colours can be represented. Typically, eight bits are used for each of
the red, green and blue components. This gives over 16 million (224) available
colours and is often referred to as true-colour [23].

The application programmer's interface (API) abstracts away from the graphics
hardware and contains functions as part of a graphics library. Early APIs such
as the Graphics Kernel System (GKS) were two-dimensional (Section 3.4).
Three-dimensional graphics APIs (Section 3.5) include the Programmer's
Hierarchical Interactive Graphics System (PHIGS), OpenGL and DirectX.

The modelling phase is the specification of a scene by the generation of
geometric objects. Primitives are low-level objects such as lines or polygons
and are defined by a set of vertices. The appearance of primitives is determined
by attributes, such as colour, which specify how the object is to be rendered.
The modelling phase also includes specifying the camera location, clipping
planes and lighting effects [23].

The rendering process is computationally expensive. In a complex scene, there
may be a large number of vertices that define the objects, each of which must be
processed in a similar manner. To increase the throughput of the processor, the
rendering process is pipelined [23]:

Figure 3.5 - The Graphics Pipeline
(Adapted from [23] and [26])

Graphics systems use a mixture of raster and vector graphics to produce two- and
three-dimensional images. Three-dimensional graphics use a synthetic camera
model. Graphics APIs model objects as geometric primitives. The rendering
pipeline performs a sequence of operations on these primitives resulting in a
rasterised image in the frame buffer which can then be displayed.