Does anyone where I can find code for a triangle index converter? Something
simple like it takes as input a list of indices and returns a list of indices?
It has to convert:
GL_TRIANGLE_STRIP -> GL_TRIANGLES
GL_TRIANGLE_FAN -> GL_TRIANGLES
and the reverse case:
GL_TRIANGLES -> GL_TRIANGLE_STRIP
GL_TRIANGLES -> GL_TRIANGLE_FAN
[This message has been edited by Dat (edited 08-27-2003).]
the first case (strips -> normal triangles) is trivial, you can surely do that on your own the second case, turning triangles to triangle strips, is a rather demanding task for which you need a program called “striper”.
And simply to provide the vertex indices is not sufficient for striping, due to the fact that two triangles that share one vertice can have DIFFERENT normal vectors at that vertex and DIFFERENT tex coords when they are rendered as separate triangles (not to mention completely different material properties), but have the SAME when rendered as triangle strips. so the striper has to find out all these tings, quite a complex task. I only know of one striper called “striper” g which reads .obj and writes .objf, but I cannot find it on google. But it did not make very much sense anyway, due to the lach of normals and tex coords, it only did the vertices.
You can find a triangle to strip converter, but it only converts the triangles to strips, it does not handle anything else like material and normal problems.
>>triangles (not to mention completely
>>different material properties), but have
>>the SAME when rendered as triangle strips.
>>so the striper has to find out all these
>>tings, quite a complex task.
hence you know now why triangle strips are mainly used for large terrain rendering…