To solve this problem, you can tell OpenGL whether a particular
vertex precedes a boundary edge.
By default, all vertices are marked as preceding a boundary edge, but
you can manually control the setting of the edge flag with the command
glEdgeFlag*():
void glEdgeFlag(GLboolean flag);
void glEdgeFlagv(const GLboolean *flag);
If flag is GL_TRUE or "true" (default), any vertices created are considered to precede boundary edges.
This command is used between glBegin() and
glEnd() pairs,
it affects all the vertices specified after it until the next glEdgeFlag()
call is made.
It applies only to vertices
in GL_POLYGON_MODE, GL_POINT or GL_LINE.
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_POLYGON); glEdgeFlag(true); glVertex3fv(V0); glEdgeFlag(false); glVertex3fv(V1); glEdgeFlag(true); glVertex3fv(V2); glEnd();