GL_TRIANGLE_STRIP Winding

I just finish writing my own triangle stripifier, so far so good, now Im facing a problem when Im enabling glCullFace, some triangle doesn’t show up, how can I fix this problem. I know that Im having an issue with winding, Im using GL_CCW, my question is how can I detect and fix the winding problem?

Thanks in advance,

Cheers,

I think the problem is likely that you end up accidentally changing winding order when you include a degenerate to stitch strips together. For strips, if you look at the order of the vertices in the list, it is as if the winding changes each triangle. A list of triangles forming a rectangle, would be indexed like this:

0, 1, 2, 2, 1, 3

While the strip would be like this:

0, 1, 2, 3

Obviously, the 1, 2, 3 triangle has the vertices appear in reverse winding order in the index list.

As for finding the problem visually, I might suggest trying to apply a repeating set of colors to the triangles in the strips to allow you to more easily identify which one went wrong. Algorithmically, you could create a triangle class that consists of 3 indices. The indices are stored in winding order for each triangle with the lowest index first, and it implements a less than operator by comparing the first element, then the second, then the third. By instantiating a set of these, you can fill it with the triangles from the original mesh, then you can check each triangle from the strips you create to see whether they are in the set. If the winding order was flipped, then this one won’t be in there.

-Evan

Check out this thread .

Also:
Strippers
Vertex Cache Optimization