View Full Version : GL_TRIANGLE_STRIP Winding
03-12-2007, 05:48 PM
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,
03-12-2007, 06:04 PM
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.
03-12-2007, 06:14 PM
Check out this thread (http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=2;t=021237) .
03-12-2007, 06:30 PM
Vertex Cache Optimization (http://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BVertex%20Cache%20Optimisation %5D%5D)
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.