问题
In order to create a VBO in OpenGl, I need to convert polygons to triangles. Is there an example of script/code somewhere that would describe this ? I would need something robust for convex and concave polygons.
回答1:
Ear clipping is by far the best way to do this.
It is fully robust for both convex and concave polygons and runs in O(n^2) time
回答2:
Implement Chazelle's method. Triangulation in linear time! What's not to like? :)
More realistically, poly2tri.
回答3:
GLU tesselators provide a flexible way to do this.
来源:https://stackoverflow.com/questions/7316000/convert-polygon-to-triangles