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

   
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
David Blythe
1999-08-06