Graphics Reference
In-Depth Information
The Traditional View
When you develop a graphics application with the OpenGL API, you define
geometry, viewing, projection, and a number of appearance properties.
Objects' geometries are defined by their vertices, their normals, and their
graphics primitives, specified by glBegin-glEnd pairs that encompass points,
lines, geometry-compressed groups, or polygons. Viewing and projection are
each defined with a specific function. Appearance is specified by defining
color, shading, materials, and lighting, or texture mapping. This information
is all processed in a very straightforward way by the fixed-function OpenGL
system, acting either in software or in a graphics card.
The simplest way to view OpenGL's operations is to think of it as using
two connected operations: a vertex-processing operation and a pixel-processing
operation . Each operation in fixed-function OpenGL has a pre-determined set
of capabilities. It is important to understand how the geometry and appear-
ance directives you give are carried out in the pipelines. When you work with
shaders, though, it is more than important to understand the pipelines; your
shaders will actually take over part of these operations, so you absolutely must
understand them.
The Vertex Operation
To create the geometry of a scene, you specify primitives and vertices, and
operations that act on each vertex and create its pixel coordinates in screen
space. The primitive you specified then determines the pixels that must be
filled to represent it, and any appearance information you specified is used to
determine how those pixels are to be colored in the pixel-processing operation.
The geometry part of the vertex processing follows the flow in Figure 1.1. The
geometry processing is carried out for each vertex independently of any infor-
mation on grouping in your specified primitive; the grouping information is
only used after the vertices finish the vertex processing.
The first stage of the vertex operation defines the fundamental geom-
etry of your scene. The input to this stage is the set of vertex definitions (your
glVertex* , glNormal* , and glTexCoord* function calls) and the grouping defi-
nition (your glBegin(...) and glEnd( ) function calls) that you set for the
scene. Each piece of geometry is created, or modeled, in its own model space.
This coordinate space can be anything that makes it easy for you to define
the vertices and relationships for your model. Modeling functions include any
operations you may need to create these definitions and often use mathemati-
cal functions operating in the model space. As we noted, the geometry might
Search WWH ::




Custom Search