Reading triangle strips

Hi,
I don’t know if this is the right forum to ask this, but here goes.

A friend sent me an extracted data of a triangle strip and ask me to write a Wavefront OBJ converter for it. Currently I’m at loss of how to interpret the face indices cos there’s many consecutive indices to the vertex array. Here’s a sample of the indices:

0, 1, 2, 3, 4, 5, 5, 6, 6, 0, 7, 2, 8, 4, 4, 9, 9, 9, 10, 7, 11, 8, 12, 4, 13, 5, 14, 14, 15, 15, 14, 16, 13, 12, 12, 17,...

AFAIK in a strip, except the 1st face, each face shares two vertices with the previous. So by that asumption, the face list should be:

(0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 5), ...

Notice the last face which have it’s 2 vertices the same. It’s been verified that the the data come from a single strip.

Can anybody help me?
Thanks
PS: the friend is currently incommunicado.

I guess they’re using the two points on the same spot, then 2 points in a new position to restart the triangle strip - so you get triangles with zero dimensions.

1-3-5
|||
0-2-4
|||
6-7-8

When they form the triangle strip 0-1-2-3-4-5, they then repeat 5, which will create a zero area triangle (4, 5, 5), then another zero area triangle (5, 5, 6), then they start drawing properly again (6, 0, 7, 2, 8, 4).

I’m not sure whether this is a good idea or not, someone else might be able to help there. But if you’re just forming triangles, then just ignoring the ones that have repeated values should be fine.

Reading http://en.wikipedia.org/wiki/Triangle_strip, it mentions primitive restart as an recent alternative:

glEnable(GL_PRIMITIVE_RESTART);
// whenever this index is reached, primitive will restart
glPrimitiveRestartIndex(index_to_restart_on);

Thanks for the reply. The idea of restarting a strip/degenerate triangle is new to me. I always think you have to separate the strip if things is not “conducive” for including it in one strip.

This made me curious on the opposite side, the algorithm which support degenerate triangles in making strips from a list of arbitrary triangles. Can anybody point me to one?

Thanks

One name for this process is stripification. NVidia has this on their website: http://developer.nvidia.com/object/nvtristrip_library.html

http://www.opengl.org/resources/faq/technical/performance.htm mentions http://www.cs.sunysb.edu/~stripe/

There’s some related discussion at: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=290448