![]() |
|Download Files|
![]() ![]() ![]() ![]() ![]() Next: 4.1.7 Dithering Up: 4.1 Per-Fragment Operations Previous: 4.1.5 Depth buffer test
4.1.6 Blending
Blending combines the incoming fragment's R, G, B, and A
values with the R, G, B, and A
values stored in the framebuffer at the incoming fragment's The command that controls blending is
void BlendFunc ( enum src, enum dst ) ; src indicates how to compute a source blending factor, while dst indicates how to compute a destination factor. The possible arguments and their corresponding computed source and destination factors are summarized in Tables 4.1 and 4.2. In these tables a subscript of s indicates a value from an incoming fragment; one of d indicates the corresponding current framebuffer value. Division of a quadruplet by a scalar means dividing each element by that value. Addition or subtraction of quadruplets or triplets means adding or subtracting them component-wise. The computations in Tables 4.1 and 4.2 are effectively carried out in floating-point and yield floating-point blending factors. Destination (framebuffer) components referred to in the tables are taken to be fixed-point values represented according to the scheme given in section 2.13.9 (Final Color Processing), as are source (fragment) components. Any implied conversion to floating-point must leave 0 and 1 invariant.
The computed source and destination blending quadruplets are applied to the source and destination R, G, B, and A values to obtain a new set of values that are sent to the next operation. Let the source and destination blending quadruplets be S and D, respectively. Then a quadruplet of values is computed as
where multiplication of quadruplets means multiplying them
component-wise.
Then each value in this quadruplet is clamped to The state required is two integers indicating the source and destination blending functions and a bit indicating whether blending is enabled or disabled. The initial state of the blending functions is ONE for the source function and ZERO for the destination function; initially, blending is disabled.
Blending occurs once for each color buffer currently enabled for writing
(section 4.2.1) using each buffer's color for
![]() ![]() ![]() ![]() ![]() Next: 4.1.7 Dithering Up: 4.1 Per-Fragment Operations Previous: 4.1.5 Depth buffer test David Blythe Sat Mar 29 02:23:21 PST 1997
|