Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL ES - Draw Triangle with line only?

Tags:

opengl-es

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

like image 821
webnoon Avatar asked Jul 10 '11 16:07

webnoon


2 Answers

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

glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);

You have to set this every frame

like image 146
Luke Avatar answered Nov 17 '22 09:11

Luke


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.

like image 23
Wroclai Avatar answered Nov 17 '22 11:11

Wroclai