In my program i get several polgons through image processing. When drawing these with GL_LINE_LOOP all goes well, but when I swicth to GL_POLYGON, the fill skips a few corners, probably normal behaviour, but i want to know how to draw the entire shape correctly.
See the image for an example shape. How can i make sure that i wind up with the figure on the left filled with a pure white and not the figure on the right.
I think the way the GL_POLYGON and GL_TRIANGLE_FAN work is that the first two points specify the first two points of the first triangle and then every point after is used to make a new triangle from the previous two vertexes. This means that you can’t just give openGL an outline of the shape you want to draw - but instead all the points for the shape as represented by a series of triangles.
That is why ofBeginShape is nice - you don’t have to figure out the triangulation yourself
[quote author=“theo”]If you would just like to draw the shape on the left filled. Try
ofFill();
ofBeginShape();
ofVertex(x1, y1);
… etc
ofEndShape(true);
[/quote]
Feel kind of stupid, of course this works. Got my mind set to GL that it was hard to get it out of there. For now this works, untill speed-issues arise of course