Name

glSampleCoverage — specify mask to modify multisampled pixel fragments

C Specification

void glSampleCoverage(GLclampf value,
 GLboolean invert);
 
void glSampleCoveragex(GLclampx value,
 GLboolean invert);
 

Parameters

value

Specifies the coverage of the modification mask. The value is clamped to the range [0, 1], where 0 represents no coverage and 1 full coverage. The initial value is 1.

invert

Specifies whether the modification mask implied by value is inverted or not. The initial value is GL_FALSE.

Description

glSampleCoverage defines a mask to modify the coverage of multisampled pixel fragments. This capability is used for antialiased screen-door transparency and smooth transitions between two renderings of an object (often for level-of-detail management in simulation systems).

When multisampling is enabled (see glEnable with argument GL_MULTISAMPLE) a ``fragment mask'' is computed for each fragment generated by a primitive. This mask reflects the amount of the pixel covered by the fragment, and determines the frame buffer samples that may be affected by the fragment.

If conversion of alpha values to masks is enabled (glEnable with argument GL_SAMPLE_ALPHA_TO_COVERAGE), the fragment alpha value is used to generate a temporary modification mask which is then ANDed with the fragment mask. One way to interpret this is as a form of dithering: a multivalued alpha (coverage or opacity) for the whole fragment is converted to simple binary values of coverage at many locations (the samples).

After conversion of alpha values to masks, if replacement of alpha values is enabled (glEnable with argument GL_SAMPLE_ALPHA_TO_ONE), the fragment's alpha is set to the maximum allowable value.

Finally, if fragment mask modification is enabled (glEnable with argument GL_SAMPLE_COVERAGE), glSampleCoverage defines an additional modification mask. value is used to generate a modification mask in much the same way alpha was used above. If invert is GL_TRUE, then the modification mask specified by value will be inverted. The final modification mask will then be ANDed with the fragment mask resulting from the previous steps. This can be viewed as an ``override'' control that selectively fades the effects of multisampled fragments.

Note that glSampleCoverage(value, GL_TRUE) is not necessarily equivalent to glSampleCoverage(1.0 - value, GL_FALSE); due to round-off and other issues, complementing the coverage will not necessarily yield an inverted modification mask.

Associated Gets

glGet with argument GL_SAMPLE_COVERAGE_VALUE

glGet with argument GL_SAMPLE_COVERAGE_INVERT

glIsEnabled with argument GL_SAMPLE_ALPHA_TO_COVERAGE

glIsEnabled with argument GL_SAMPLE_COVERAGE

See Also

glEnable

Copyright

Copyright © 2003-2004 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.