I am having difficulty understanding the meaning of the first parameter in glPolygonOffset
function.
void glPolygonOffset(GLfloat factor, GLfloat units);
The official documentation says that factor
Specifies a scale factor that is used to create a variable depth offset for each polygon.
and that
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 factor × DZ + r × units , where DZ is a measurement of the change in depth relative to the screen area of the polygon, and r is the smallest value that is guaranteed to produce a resolvable offset for a given implementation.
I understand what r
and unit
are. What I don't understand is what DZ
is, i.e. what is meant by the "measurement of the change in depth value to the screen area of the polygon" and why would I ever need to set factor to anything other than 0.
If i want my wireframe to be offset all I need is to add/substact a couple of units to/from the depth value, don't I? What's the meaning, purpose and usage example of the factor parameter (and the DZ mentioned in the document)?