Wireframe in OpenGL

There are 3 approaches I know about:

1. ) glPolygonMode

glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDrawArrays(GL_TRIANGLES, 0, numOfVertices);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

2.) For OpenGL ES

http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/

3.) Dirty way to draw wireframe

for(ulong i = 0; i < numOfVertices; i += 3)
glDrawArrays(GL_LINE_LOOP, i, 3);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s