How can you get rid of such bad effects?
Li Cai
Polygon Offset is typically used to account for Z fighting between
overlapping coplanar primitives. If you don't want to use polygon offset,
there are a few other options available to you.
You can simulate the effects of polygon offset by tinkering with
glDepthRange. For example, a program might:
glDepthRange (0.1, 1.0);
/* Draw underlying geometry */
glDepthRange (0.0, 0.9);
/* Draw overlying geometry */
This provides a fixed offset in Z but does not take the polygon slope into
account. It is roughly equivalent to using glPolygonOffset with a factor
parameter of 0.0.
The Stencil buffer may be used in several creative ways to render coplanar
primitives. The most well known method is outlined in the red book. The
algorithm for drawing a polygon and its outline, for example, is as follows:
1) Draw the outline into the color buffer, depth buffer, and stencil buffer.
2) Draw the filled primitive into the color buffer and depth buffer, but
only where the stencil buffer is clear.
3) Mask off the color and depth buffers, and render the outline to clear the
stencil buffer.
On an SGI system, an application may use the SGIX_reference_plane extension.
With this extension, the user specifies a plane equation in world
coordinates corresponding to a set of coplanar primitives. The plane can be
enabled or disabled. When enabled, all fragment Z values are derived from
the specified plane equation. Thus for any given fragment XY location, the
depth value is guaranteed to be identical regardless of the primitive which
rendered it.
Hope this helps.
-Paul Martz
Hewlett Packard Workstation Systems Lab
To reply, remove "DONTSPAM" from email address.