GlPolygonOffset whats the deal here? is it good or bad?,
Members - Reputation: 122
Posted 26 July 2005 - 10:10 PM
Crossbones+ - Reputation: 3229
Posted 27 July 2005 - 09:28 AM
There are some performance reasons not to use glPolygonOffset. Since the polygon slope is factored into the actual distance that fragments are moved forward or backward in the z-buffer, fragments inside very steeply sloped (with respect to the camera) polygons can end up having a z value anywhere in the entire depth range. For this reason, hardware hierarchical z-culling algorithms have to be disabled or severely limited for regions in which polygons are rendered with glPolygonOffset turned on.
An alternative is to modify your projection matrix to perform a z-offset. You can read about this technique in Game Programming Gems 1, Section 4.1, or in Mathematics for 3D Game Programming and Computer Graphics, Section 9.1. Source code can be found here: