hide random home http://www.sgi.com/tech/openGL/paper/subsection3_4_6.html (Silicon Surf Promotional CD, 01/1995)



Next: 4.7 Miscellaneous Functions Up: 4 The OpenGL Pipeline Previous: 4.5 The Framebuffer

4.6 Per-Fragment Operations

Before being placed into its corresponding frame buffer location, a fragment is subjected to a series of tests and modifications, each of which may be individually enabled, disabled, and controlled. The tests and modifications include the stencil test, the depth buffer test (typically used to achieve hidden surface removal), and blending. We briefly describe only a subset of the tests; for specifics, the reader should consult [10].

The stencil test, when enabled, compares the value in the stencil buffer corresponding to the fragment with a reference value. If the comparison succeeds, then the stored stencil value may be modified by a function such as increment, decrement, or clear, and the fragment proceeds to the next test. If the test fails, the stored value may be updated using a different function, and the fragment is discarded. Similarly, the depth buffer test compares the fragment's depth value with the corresponding value stored in the depth buffer. If the comparison succeeds, the fragment is passed to the next stage, and the fragment's depth value replaces the value stored in the depth buffer (if the depth buffer has been enabled for writing). If the comparison fails, the fragment is discarded, and no depth buffer modification occurs.

Blending mixes a fragment's color with the corresponding color already stored in the framebuffer (blending occurs once for each color buffer enabled for writing). The exact blending function may be specified with glBlendFunction.

Blending is the operation that actually achieves antialiasing for RGBA colors. Recall that the coverage computation only modifies a fragment's alpha value; this alpha value must be used to blend the fragment color with the already stored background color to obtain the antialiasing effect. Blending is also used to achieve transparency.

In addition to modifying individual framebuffer values with a series of fragments, a whole buffer or buffers may be cleared to some specifiable constant value. Clear values are maintained for the color buffers (all color buffers share a single value), the stencil buffer, the depth buffer, and the accumulation buffer.



Next: 4.7 Miscellaneous Functions Up: 4 The OpenGL Pipeline Previous: 4.5 The Framebuffer


segal@asd.sgi.com
Fri Sep 23 16:08:14 PDT 1994