GL_IMG_polygon_offset_clamp#

Supported Hardware#

Series5XT, Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 1.x, 2.0, 3.0

Description#

This extension adds a new parameter to the polygon offset function that clamps the calculated offset to a minimum or maximum value. 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.

Note#

OpenGL ES 1.0 is required.

This extension is written against the OpenGL ES 3.1 Specification (October 29, 2014).

If the GL_EXT_polygon_offset_clamp is present, the EXT variant of this extension will be recommended to use.

Example#

//<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. Calling the command PolygonOffset is equivalent
//to calling the command PolygonOffsetClampIMG with <clamp> equal to
//zero."
//    |   m x <factor> + r x <units>,          if <clamp> = 0 or NaN;
//    |
//o = <    min(m x <factor> + r x <units>, <clamp>),   if <clamp> > 0;
//    |
//    |_  max(m x <factor> + r x <units>, <clamp>),   if <clamp> < 0.
float factor = 0.2f;
float units = 0.2f;
float clamp = 0.2f;
glPolygonOffsetClampIMG(factor, units, clamp);