How do you render primitives as wireframes in OpenGL?

Phineas picture Phineas · Sep 26, 2008 · Viewed 128.9k times · Source

How do you render primitives as wireframes in OpenGL?

Answer

Mike F picture Mike F · Sep 26, 2008
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );

to switch on,

glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );

to go back to normal.

Note that things like texture-mapping and lighting will still be applied to the wireframe lines if they're enabled, which can look weird.