[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 Version 4.1 for AIX: Programming Concepts

Understanding the Frame Buffer

Effective use of the full capabilities of GL requires an understanding of the frame buffer and its organization. GL supports overlay planes, underlay planes, a double-buffered "main" frame buffer, a z-buffer, an alpha buffer, color maps, and gamma ramps (see the figure entitled Frame Buffer Configuration). These can be turned on or off, reconfigured, masked with writemasks, and so on. However, the actual number of bitplanes in each buffer varies from adapter to adapter, and therefore the ways in which these bitplanes can be configured and controlled vary from adapter to adapter. The following sections present some basic concepts about the operation of a frame buffer. Following these brief discussions are descriptions of the characteristics of the different systems.

Main Color Buffer

The main color buffer can be thought of as having the width and height of the window and a depth that can vary from 8 bits to 48 bits, depending on the current configuration and the installed adapter. Pixels stored in this main buffer can be interpreted through a downstream color map (that is, the values stored in the frame buffer are color map indexes), or they can be interpreted directly as red, green, blue (RGB) values, with no intervening color maps. (For more information on how to use or bypass the color maps, see "Working in Color Map and RGB Modes".)

The main color buffer can be single buffered or double buffered, depending on the current configuration and the installed adapter. In double buffer mode, the main color buffer is divided in two: the front buffer, which is visible, and the back buffer, which is invisible but can be drawn into. Double buffering is an important technique used to provide smooth animation of moving pictures. (For more information on how to use double buffering, see "Creating Animated Scenes".)

The color map configuration and single and double buffer configuration can be changed dynamically by making appropriate GL subroutine calls. The scope of such reconfiguration extends only over the current drawing window.

Multiple windows can appear on the screen, each independently double buffered, each in color map or RGB mode independent of the others. There is no limit to the number of such windows.

Overlay and Underlay Buffers

Like the main color buffer, the overlay and underlay buffers have the width and height of the window. Their depth can range from 0 to 4 bits deep, depending on the installed adapter and the current configuration. Overlay and underlay bitplanes cannot be double buffered and are always in color map mode.

Overlays and underlays function exactly as the names suggest: drawing into the overlay buffer obscures the main color buffer, and drawing into the main color buffer obscures the underlay. (For more information on overlays and underlays, consult "Underlay and Overlay Modes".)

Some sophisticated applications find that four overlay and four underlay planes are not enough. Multiple overlays or underlays, even double-buffered overlays and underlays, can be created by appropriately manipulating the color map and the writemasks associated with the main color buffer. Such tricks can easily get quite complicated, and such extra overlays have effectively been stolen from the main color buffer. (For more information on writemasks, see "Writemasks and Logical Operations".)

Alpha Buffer

In order for GL to support an alpha blending (transparency) buffer, the installed adapter must contain an alpha buffer. (For more information on alpha blending, see "Alpha Blending Modes ".)


The z-buffer stores the z value for each pixel on the screen. The z value represents the z coordinate, or distance to the eye, for each pixel. When z-buffering is enabled with the zbuffer subroutine, the system compares the z values for each pixel of any new polygon, line, point, or character to the current z value for each pixel and renders only those values representing a distance closer to the eye. (For further discussion of z-buffering, see "Removing Hidden Surfaces".)

Query Functions

The query functions available for determining the current frame buffer configuration are the getdrawmode, getplanes, and getzbuffer subroutines.

[ Previous | Next | Contents | Glossary | Home | Search ]