Rasterizing

Rasterizing is the process by which a primitive is converted to a two-dimensional image. Each point of this image contains such information as color, depth, and texture data. A point and its associated information are called a fragment. The current raster position, as specified with glRasterPos*, is used in various ways during this stage for drawing pixels and bitmaps. Different issues arise when rasterizing points, line segments, and polygons. In addition, pixel rectangles and bitmaps need to be rasterized.

With OpenGL you control rasterizing by using the following functions:

  • Primitives. Control how primitives are rasterized using functions that determine dimensions and stipple patterns: glPointSize, glLineWidth, glLineStipple, and glPolygonStipple. Control how the front and back faces of polygons are rasterized with glCullFace, glFrontFace, and glPolygonMode.
  • Pixels. Several functions control pixel storage and transfer modes. The function glPixelStore* controls the encoding of pixels in client memory, and glPixelTransfer* and glPixelMap* control how pixels are processed before being placed in the framebuffer. Specify a pixel rectangle with glDrawPixels; control its rasterization with glPixelZoom.
  • Bitmaps. Bitmaps are rectangles of zeros and ones specifying a particular pattern of fragments to be produced. Each of these fragments has the same associated data. The glBitmap function specifies a bitmap.
  • Texture Memory. When texturing is enabled, texturing maps a portion of a specified texture image onto each primitive. This mapping is accomplished by using the color of the texture image at the location indicated by a fragment's texture coordinates to modify the fragment's RGBA color. Specify a texture image with glTexImage2D or glTexImage1D. The glTexParameter* and glTexEnv* functions control how texture values are interpreted and applied to a fragment.
  • Fog. To blend a fog color with a rasterized fragment's post-texturing color, use a blending factor that depends on the distance between the eyepoint and the fragment. Use glFog* to specify the fog color and blending factor.