Sunday, November 23, 2008

Wireframe mode in OpenGL

Here's an easy way to have a togglable wireframe mode in OpenGL (useful for debuging):

bool isWire = true;
...
if (isWire) {
glPolygonMode(GL_FRONT, GL_LINE);
glPolygonMode(GL_BACK, GL_LINE);
}
...(draw)...
glPolygonMode(GL_FRONT, GL_FILL);
glPolygonMode(GL_BACK, GL_FILL);

No comments: