Displaying Triangle Outlines

I’d like to implement something similar to the Q2/Q3 r_showtris command, where you can see a white outline around each triangle.

I’ve been able to get a similar effect using glPolygonMode and rendering each frame twice, once with GL_FILL and once with GL_LINE, but this requires an if for every texture bind, glColor, etc… to make sure the tri outlines are white and untextured.

Is there any cleaner way (ie. minimal additional logic during the main render) to do this? How does Q2/Q3 do it?

You can just do glDisable(GL_TEXTURE_2D) so that you don’t have to worry about the texturing commands, but there isn’t anything similar to prevent changing the colour.

Then, don’t use one function like
draw(bool wire)
but use two like


draw wire then will assure that it only draws untextured, unlit faces. BTW: The PolygonMode is very uneffective, since it will draw any line in any closed mesh twice.

I dumped a GL log of Q3, and it draws everything using CVA’s, including the GUI. This makes the problem much easier as you can just do this:

load verts
enable vert pointer
lock verts
load colors
load tex coords
enable color pointer
enable texture pointer
render arrays
if wire then
disable color pointer
disable texture pointer
switch to line rendering
render arrays

spin, dry, repeat… for each mesh/gui window

Simple, clean, and fast. Carmack is cool .

[This message has been edited by joat (edited 11-17-2000).]

[This message has been edited by joat (edited 11-17-2000).]