next up previous contents
Next: 7.2.2 glDepthRange Up: 7.2 Hidden Lines Previous: 7.2 Hidden Lines   Contents

7.2.1 glPolygonOffset

In addition to the above methods which enable and disable various modes during the two passes of rendering, the glPolygonOffset() command may be used to move the lines and polygons relative to each other. If the edges are drawn as lines in polygon mode, glEnableGL_ POLYGON_OFFSET_LINE(GL_ POLYGON_OFFSET_LINE) can be used to move the lines a little bit in front of the polygons. If a faster version of drawing the lines is used (as described in Section 7.1), glEnableGL_ POLYGON_OFFSET_FILL(GL_ POLYGON_OFFSET_FILL) will move the polygon surfaces a little bit behind the lines.

Keep in mind, however, that glPolygonOffset() is designed to provide greater offsets for polygons viewed more edge-on than for polygons that are flatter relative to the screen. This means that additional work is done for each polygon which could slow down rendering. An advantage, however, is that once the parameters have been tuned for a particular OpenGL implementation, the same unmodified code should work well on other implementations.



2001-01-10