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.
If you would just like to draw the shape on the left filled. Try
You can see more on how to use this in the polyShapeExample/
If you want to do it directly in openGL (it will be more calculations for you but faster for filled shapes) you can check the docs here:
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
Print out these guys and tape them up close to your workstation, works for me
OpenGL texture coordinates:
oh wow - thats awesome!
printing right now
[quote author=“theo”]If you would just like to draw the shape on the left filled. Try
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
Thanks a lot!