i
i
i
i
i
i
i
i
13.1. Visualizing a Virtual World Using OpenGL 307
• RAM. More precisely video or vRAM. This stores the results of the
rendering process in a frame buffer. U sually two or more buffers are
available. Buffers do not just store color pixel data. The Z depth buffer
is a good example of an essential buffer with its role in the hidden
surface elimination algorithm. Others such as the stencil buffer have
high utility when rendering shadows and lighting effects. vRAM may
also be used for storing vertex vectors and particularly image/texture
maps. The importance of texture map storage cannot be overempha-
sized. Realistic graphics and many other innovative ideas, such as doing
high-speed mathematics, rely on big texture arrays.
• Processor. Before the processor inherited greater significance by becom-
ing externally programmable (as discussed in Chapter 14), its primary
function was to carry out floating-point vector arithmetic on the in-
coming vertex data ,e.g., multiplying the vertex coordinates with one
or more matrices. Since vertex calculations and also fragment calcu-
lations are independent of other vertices/fragments, it is possible to
build several processors into one chip and achieve a degree of paral-
lelism. When one recognizes that there is a sequential element in the
rendering algorithm—vertex data transformation, clipping, rasteriza-
tion, lighting etc.—it is also possible to endow the adapter chipset with
a pipeline structure and reap the benefits that pipelining has for com-
puter processor architecture. (But without many of the drawbacks such
as conditional branching and data hazards.) Hence the term often used
to describe the process of rendering in real time, passing through the
graphics pipeline.
So, OpenGL drives the graphics hardware. It does this by acting as a state
machine. An application program uses functions from the OpenGL library to
set the machine into an appropriate state. Then it uses other OpenGL library
functions to feed vertex and bitmap data into the graphics pipeline. It can
pause, send data to set the state machine into some other state (e.g., change
the color of the vertex or draw lines rather than polygons) and then continue
sending data. Application programs have a very richly featured library of
functions with which to program the OpenGL state machine; they are very
well documented in [6]. The official guide [6] does not cover programming
with Windows very comprehensively; when using OpenGL with Windows,
several sources of tutorial material are available in books such as [7].
Figure 13.2 illustrates how the two main data streams, polygon geometry
and pixel image data, pass through the graphics hardware and interact with