Original Post
I have been experimenting with .x files from two software packages. One exports all the faces as triangles and another sometimes uses polygons with 4 or more verticies. Is there a simple way to take a n-sided polygon and break it up into triangles? I can load and draw mesh data from the software with all triangles. The other files do not load. example all triangles: Other files
Mesh CubeMesh {
14;
1.000000;-1.000000;1.000000;,
1.000000;1.000000;1.000000;,
-1.000000;-1.000000;1.000000;,
-1.000000;1.000000;1.000000;,
1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;1.000000;-1.000000;,
1.000000;1.000000;-1.000000;,
1.000000;-1.000000;1.000000;,
1.000000;1.000000;1.000000;,
1.000000;-1.000000;-1.000000;,
1.000000;1.000000;-1.000000;,
1.000000;1.000000;1.000000;,
1.000000;-1.000000;1.000000;;
12;
3;1,3,2;,
3;0,1,2;,
3;2,5,4;,
3;8,2,4;,
3;2,3,6;,
3;5,2,6;,
3;9,7,6;,
3;3,9,6;,
3;10,5,6;,
3;11,10,6;,
3;10,11,12;,
3;13,10,12;;
Mesh pCubeShape1 {
24;
-0.500000;-0.500000;0.500000;,
0.500000;-0.500000;0.500000;,
-0.500000;0.500000;0.500000;,
0.500000;0.500000;0.500000;,
-0.500000;0.500000;-0.500000;,
0.500000;0.500000;-0.500000;,
-0.500000;-0.500000;-0.500000;,
0.500000;-0.500000;-0.500000;,
-0.500000;0.500000;0.500000;,
0.500000;0.500000;0.500000;,
-0.500000;0.500000;-0.500000;,
0.500000;0.500000;-0.500000;,
-0.500000;-0.500000;-0.500000;,
0.500000;-0.500000;-0.500000;,
0.500000;-0.500000;0.500000;,
-0.500000;-0.500000;0.500000;,
0.500000;-0.500000;0.500000;,
0.500000;-0.500000;-0.500000;,
0.500000;0.500000;-0.500000;,
0.500000;0.500000;0.500000;,
-0.500000;-0.500000;-0.500000;,
-0.500000;-0.500000;0.500000;,
-0.500000;0.500000;0.500000;,
-0.500000;0.500000;-0.500000;;
6;
4;0,1,3,2;,
4;8,9,5,4;,
4;10,11,7,6;,
4;12,13,14,15;,
4;16,17,18,19;,
4;20,21,22,23;;