23.06.2013 Views

The OpenGL Graphics System: A Specification

The OpenGL Graphics System: A Specification

The OpenGL Graphics System: A Specification

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.9. COLOR SUM 191<br />

results of texture blending are undefined.<br />

<strong>The</strong> required state, per texture unit, is four bits indicating whether each of one-,<br />

two-, three-dimensional, or cube map texturing is enabled or disabled. In the intial<br />

state, all texturing is disabled for all texture units.<br />

3.9 Color Sum<br />

At the beginning of color sum, a fragment has two RGBA colors: a primary color<br />

cpri (which texturing, if enabled, may have modified) and a secondary color csec.<br />

If color sum is enabled, the R, G, and B components of these two colors are<br />

summed to produce a single post-texturing RGBA color c. <strong>The</strong> A component of c<br />

is taken from the A component of cpri; the A component of csec is unused. <strong>The</strong><br />

components of c are then clamped to the range [0, 1]. If color sum is disabled, then<br />

cpri is assigned to c.<br />

Color sum is enabled or disabled using the generic Enable and Disable commands,<br />

respectively, with the symbolic constant COLOR SUM. If lighting is enabled<br />

and if a vertex shader is not active, the color sum stage is always applied, ignoring<br />

the value of COLOR SUM.<br />

<strong>The</strong> state required is a single bit indicating whether color sum is enabled or<br />

disabled. In the initial state, color sum is disabled.<br />

Color sum has no effect in color index mode, or if a fragment shader is active.<br />

3.10 Fog<br />

If enabled, fog blends a fog color with a rasterized fragment’s post-texturing color<br />

using a blending factor f. Fog is enabled and disabled with the Enable and Disable<br />

commands using the symbolic constant FOG.<br />

This factor f is computed according to one of three equations:<br />

f = exp(−d · c), (3.30)<br />

f = exp(−(d · c) 2 ), or (3.31)<br />

f =<br />

e − c<br />

e − s<br />

(3.32)<br />

If a vertex shader is active, or if the fog source, as defined below, is FOG COORD,<br />

then c is the interpolated value of the fog coordinate for this fragment. Otherwise,<br />

if the fog source is FRAGMENT DEPTH, then c is the eye-coordinate distance from<br />

Version 2.0 - October 22, 2004

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!