What are the basics for using polygon offset?
It’s difficult to render coplanar primitives in OpenGL for two reasons: • Given two overlapping coplanar primitives with different vertices, floating point round-off errors from the two polygons can generate different depth values for overlapping pixels. With depth test enabled, some of the second polygon’s pixels will pass the depth test, while some will fail. • For coplanar lines and polygons, vastly different depth values for common pixels can result. This is because depth values from polygon rasterization derive from the polygon’s plane equation, while depth values from line rasterization derive from linear interpolation. Setting the depth function to GL_LEQUAL or GL_EQUAL won’t resolve the problem. The visual result is referred to as stitching, bleeding, or Z fighting. Polygon offset was an extension to OpenGL 1.0, and is now incorporated into OpenGL 1.1. It allows an application to define a depth offset, which can apply to filled primitives, and under OpenGL 1.1, it can be separa