Frame buffers: Color, depth, and stencil. You can find real good explanation of this topic in chatper 10 of the free OpenGL red book

opengl stencil buffer

Search for: opengl stencil buffer

what is a stencil buffer from wiki book

More on stencil buffer an article at livejournal


glStencilFunc
glStencilOp

This is a real good explanation of buffers

Each fragment has coordinate data which corresponds to a pixel, as well as color and depth values

Then each fragment undergoes a series of tests and operations, some of which have been previously described (See "Blending" in Chapter 6) and others that are discussed in this chapter. If the tests and operations are survived, the fragment values are ready to become pixels. To draw these pixels, you need to know what color they are, which is the information that's stored in the color buffer. Whenever data is stored uniformly for each pixel, such storage for all the pixels is called a buffer. Different buffers might contain different amounts of data per pixel, but within a given buffer, each pixel is assigned the same amount of data. A buffer that stores a single bit of information about pixels is called a bitplane.

A given type of buffer contains a given type of values for ALL pixels. For example a color buffer contains color values for all pixels. A depth buffer contains depth information for all pixels. A stencil buffer contains stencil information for all pixels.

As an example of a buffer, let's look more closely at the color buffer, which holds the color information that's to be displayed on the screen. Assume that the screen is 1280 pixels wide and 1024 pixels high and that it's a full 24-bit color screen - in other words, there are 224 (or 16,777,216) different colors that can be displayed. Since 24 bits translates to 3 bytes (8 bits/byte), the color buffer in this example has to store at least 3 bytes of data for each of the 1,310,720 (1280*1024) pixels on the screen. A particular hardware system might have more or fewer pixels on the physical screen as well as more or less color data per pixel. Any particular color buffer, however, has the same amount of data saved for each pixel on the screen.


color
depth
stencil

Apparently not. If it is a stereo image, apparently you have a left side and a right side buffer. If you are using double buffering then there is the front buffer and back buffer.

It is a buffer containing depth values for each pixel. Each value indicates how far the pixel is in the 'z' direction.

A stencil buffer holds a fixed number of bits for each pixel. You can then apply logic to either display that pixel or not. This is called a stencil buffer because it emulates the process when a child paints over a cut-out card board only the scene that is not covered by the card-board becomes visible.

The region of graphics memory that is modified as a result of OpenGL rendering.