next up previous contents
Next: 7.3 Haloed Lines Up: 7.2 Hidden Lines Previous: 7.2.1 glPolygonOffset   Contents

7.2.2 glDepthRange

Similar effects are available using glDepthRange() but both the polygons and the edges are drawn at the maximum speed for each type of primitive. This is done by moving the zNear value out a little bit from 0.0 while setting the zFar to 1.0 for all normal drawing. Then when the edges are drawn move the zNear value to 0.0 and reduce the zFar value by the same amount. The offset should be at least 0.00001, depending on the depth buffer accuracy and the amount of perspective used in the projection matrix, and may need to be significantly greater in many cases.

The general algorithm for an offset of EDGE_OFFSET is:

        glDepthRange(EDGE_OFFSET, 1.0);
        <draw all non-edge geometry>

        glDepthRange(0.0, 1.0 - EDGE_OFFSET);
        <draw all edges>

As with all algorithms described in this manual, it is up to the user to select the hidden line (or edge highlighting) method that best meets his needs after considering ease of implementation, speed, and image quality.



2001-01-10