next up previous contents
Next: 7.2 Hidden Lines Up: 7 Line Rendering Techniques Previous: 7 Line Rendering Techniques   Contents


7.1 Wireframe Models

If your goal is to draw a true wireframe model, as opposed to drawing a hidden line rendering of a model or highlighting edges of a model, there are several methods available (listed here in order of least efficient to most efficient):

  1. Draw the model as polygons in line mode using glBeginGL_ POLYGON(GL_ POLYGON) and glPolygonModeGL_ FRONT_AND_BACK, GL_ LINE(GL_ FRONT_AND_BACK, GL_ LINE).

    This method is by far the easiest if you're already displaying the model as a shaded solid, since it involves a single mode change. However, it is likely to be significantly slower than the other methods both because more processing usually occurs for polygons than for lines and because every edge that is common to two polygons will be drawn twice. This method is undesirable when using antialiased lines as well, because each line that is drawn twice will be brighter than any lines drawn just once.

  2. Draw the polygons as line loops using glBeginGL_ LINE_LOOP(GL_ LINE_LOOP).

    This method is almost as simple as the first, requiring only a change to the glBegin() call. However, except for possibly eliminating the extra processing required for polygons it has all of the other undesirable features as well.

  3. Extract the edges from the model and draw as independent lines using glBeginGL_ LINES(GL_ LINES).

    This method is more work than the previous two because each edge must be identified and all duplicates removed. However, the extra work must only be done once and every time the model is drawn it will be drawn much faster.

  4. Extract the edges from the model and connect as many as possible into long line strips using glBeginGL_ LINE_STRIP(GL_ LINE_STRIP).

    For just a little bit more effort than the GL_ LINES method, lines sharing common end-points can be connected into larger line strips. This has the advantage of requiring less storage, less data transfer bandwidth, and makes most efficient use of any line drawing hardware.


next up previous contents
Next: 7.2 Hidden Lines Up: 7 Line Rendering Techniques Previous: 7 Line Rendering Techniques   Contents
2001-01-10