Wire Frame Rendering

What is the fastest way to draw lots of triangular facets in wire frame mode.

I am using display lists but although this boosts the refresh rate when the facets are filled, in wire frame mode it is relatively slow.

I know that some graphics cards have problem with wire frame rendering but one commercial program that I use on my computer seems to be able to handle wire frame models without any reduction in refresh rate so I know that my computer graphics card is OK. Would the use of the vertex arrays within the display list help at all?

Many thanks

Try:

glPolygonMode(GL_LINE);

Watch your state and turn off blending, zbuffer and smooth shading if you don’t need it.

Try this with both lines and polygons in line mode to see which is faster and more functional.

Have done all of what you said but still no joy. Is there any advantage in using vertex array in the display list procedure?

Many thanks

Note that glPolygonMode(GL_LINE) (set it for both front and back) needs to draw lines of adjacent polygons twice. It’s sometimes faster if you build real wireframe geometry using GL_LINES and/or GL_LINE_STRIP.
Since display lists copy the data at built time in both cases, vertex array or immediate mode, the built time might decrease with vertex arrays, because you need less calls and the data formatting is known, but a good driver will optimize the display list in both cases.

Your mileage will vary, especially if you compare gaming hardware to workstation class graphics boards.

If you work on a modeler kind of app you probably should consider using vertex arrays, better vertex buffer objects (VBO), because they are faster and more elegant than immediate mode but give the same flexibility when editing the underlying data.

[This message has been edited by Relic (edited 01-16-2004).]

I wonder why it is that when the polygons are filled, the rendering is so much quicker. I take your point about adjacent edges being drawn twice in the wire frame mode but does this not apply in the case where the polygons are filled as well?

Most graphics cards only render triangles, so drawing a filled triangle requires it to render a single polygon. On the other hand a line is often created by drawing two really skinny triangles, so a wireframe triangle takes 6 polygons. I believe this is the reason for the slow speed of wireframe mode

That is a logical explanation especially when you want to increase the thickness of the line, the only way that it can be done is as you say representing a line with two ‘skinny’ triangles.

Is there any way of deactivating this mode if you only need a single pixel width line, ie simply draw a line from one vertex to the other?

Doubtful, I think most consumer card vendors optimize the triangle routines and don’t worry about single pixel lines since they are drawn so infrequently. I’m pretty sure professional modelers and users of AutoCad have special (expensive) cards that can do such things but I doubt you can get that functionality on a consumer level card.