next up previous contents index
Next: 2.13 Colors and Coloring Up: 2 OpenGL Operation Previous: 2.11 Clipping

2.12 Current Raster Position

 

The current raster position is used by commands that directly affect pixels in the framebuffer. These commands, which bypass vertex transformation and primitive assembly, are described in the next chapter. The current raster position, however, shares some of the characteristics of a vertex.

The current raster position consists of three window coordinates , , and , a clip coordinate value, an eye coordinate distance, a valid bit, and associated data consisting of a color and texture coordinates. It is set using one of the RasterPos  commands:

void RasterPos[234][sifd] ( T coords ) ;
void RasterPos[234][sifd]v ( T coords ) ;

RasterPos4  takes four values indicating x, y, z, and w. RasterPos3  (or RasterPos2 ) is analogous, but sets only x, y, and z with w implicitly set to 1 (or only x and y with z implicitly set to 0 and w implicitly set to 1).

The coordinates are treated as if they were specified in a Vertex  command. The x, y, z, and w coordinates are transformed by the current model-view and perspective matrices. These coordinates, along with current values, are used to generate a color and texture coordinates just as is done for a vertex. The color and texture coordinates so produced replace the color and texture coordinates stored in the current raster position's associated data. The distance from the origin of the eye coordinate system to the vertex as transformed by only the current model-view matrix replaces the current raster distance. This distance can be approximated (see section 3.9).

The transformed coordinates are passed to clipping as if they represented a point. If the ``point'' is not culled, then the projection to window coordinates is computed (section 2.10) and saved as the current raster position, and the valid bit is set. If the ``point'' is culled, the current raster position and its associated data become indeterminate and the valid bit is cleared. Figure 2.7 summarizes the behavior of the current raster position.

  
Figure 2.7: The current raster position and how it is set.

The current raster position requires five single-precision floating-point values for its , , and window coordinates, its clip coordinate, and its eye coordinate distance, a single valid bit, a color (RGBA and color index), and texture coordinates for associated data. In the initial state, the coordinates and texture coordinates are both , the eye coordinate distance is 0, the valid bit is set, the associated RGBA color is and the associated color index color is 1. In RGBA mode, the associated color index always has its initial value; in color index mode, the RGBA color always maintains its initial value.



next up previous contents index
Next: 2.13 Colors and Coloring Up: 2 OpenGL Operation Previous: 2.11 Clipping



David Blythe
Sat Mar 29 02:23:21 PST 1997