Light | Dark

glPolygonOffsetClamp

Name

glPolygonOffsetClamp — set the scale and units used to calculate depth values with clamping

C Specification

void glPolygonOffsetClamp( GLfloat factor,
  GLfloat units,
  GLfloat clamp);
 

Parameters

factor

Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0.

units

Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.

clamp

Specifies a minimum or maximum value used to clamp the calculated depth offset. The initial value is 0.

Description

When GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_LINE, or GL_POLYGON_OFFSET_POINT is enabled, each fragment's depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The value of the offset is computed by glPolygonOffsetClamp.

factor scales the maximum depth slope of the polygon, and units scales an implementation-dependent constant that relates to the usable resolution of the depth buffer. The resulting values are summed to produce the polygon offset value, which may then be clamped to a minimum or maximum value specified by clamp. The values factor, units, and clamp may each be positive, negative, or zero.

The offset value is calculated as follows:

o = m × factor + r × units if clamp = 0 or NaN min ( m × factor + r × units , clamp ) if clamp > 0 max ( m × factor + r × units , clamp ) if clamp < 0

where m is the maximum value of the absolute values of z x and z y , and r is the smallest value that is guaranteed to produce a resolvable offset for a given implementation.

The clamping functionality is useful when polygons are nearly parallel to the view direction because their high slopes can result in arbitrarily large polygon offsets. In the particular case of shadow mapping, the lack of clamping can produce the appearance of unwanted holes when the shadow casting polygons are offset beyond the shadow receiving polygons, and this problem can be alleviated by enforcing a maximum offset value.

If clamp is infinity or NaN, then no clamping is applied to the polygon offset. Denormalized values are not considered equal to zero.

Calling glPolygonOffset is equivalent to calling glPolygonOffsetClamp with clamp equal to zero.

Associated Gets

glIsEnabled with argument GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_LINE, or GL_POLYGON_OFFSET_POINT.

glGet with argument GL_POLYGON_OFFSET_FACTOR, GL_POLYGON_OFFSET_UNITS, or GL_POLYGON_OFFSET_CLAMP.

Version Support

OpenGL Version
Function / Feature Name 2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5 4.6
glPolygonOffsetClamp - - - - - - - - - - - -
Think you can improve this page? Edit this page on GitHub.