webnoon
webnoon

Reputation: 1015

OpenGL ES - Draw Triangle with line only?

Is there a way to draw a triangle with line only ? I think GL_TRIANGLES option make triangle filled with color.

Upvotes: 7

Views: 16552

Answers (3)

Ben
Ben

Reputation: 873

if you are only rendering a single triangle at a time you can use GL_LINE_LOOP. it will connect the first and last, so if you have more than one triangle, it won't work.

Upvotes: 0

Wroclai
Wroclai

Reputation: 26925

Is there a way to draw a triangle with line only?

Use GL_LINES, GL_LINE_STRIP , or GL_LINE_LOOP (difference see here) with the same vertices that you use for GL_TRIANGLES.

Upvotes: 1

Luke
Luke

Reputation: 5708

Set the fill mode with glPolygonMode(face, model):

glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);

You have to set this every frame

Upvotes: 17

Related Questions