View Full Version : Can anyone explain glPolygonOffset?
03-12-2002, 01:19 AM
Can anyone explain what glPolygonOffset(factor, units) does and the influence of each parameter (factor, units).
03-12-2002, 01:34 AM
units is a constant offset in depth values, say, you run 24bit z, setting units to 1, should offset your depth values by 1/(2<<24) (in normalized device coords).
factor brings dependency on the depth slope into that offset. Z fighting of almost coplanar primitives becomes worse the higher their depth slope is. With factor, you can let the gl automatically adjust the depth offset according to that.
glPolygonOffset(0.0f,1.0f); will unconditionally offset all polygons by one.
glPolygonOffset(1.0f,0.0f); will offset polys with a depth slope of one (rotated 45° into the screen) by one, polys parallel to the eye plane it won't offset at all.
Just play around with it a bit, for most applications a little mixture of both is good.
03-12-2002, 01:38 AM
Thanks zeckensack for your reply.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.