Billy B - 2008-01-14

There's a bug in how GL_QUAD_STRIPS are handled.
It seems the person who wrote the code didn't really understand how they work. 
This page has a good picture showing the order you send your vertices in to use GL_QUAD_STRIPS:
   http://www.research.rutgers.edu/~sueda/428Fall2005/proj2.html

The rule for quad strips is that for vertices 1,2,3,4,5,6,7,8
you make quads  1,2,4,3 ; 3,4,6,5 ; 5,6,8,7 ...

In other words you flip the order of the last two vertices of every set of 4 vertices.
It is NOT as the code seems thing a matter of flipping the orientation.
For tri_strips it may appear that the rule is to flip the orientation of every other tri, but again this rule can be seen as actually "flip the last two vertices" (of every other tri).

Becuase of this I think the "FlipPolygonStrips" setting is completely bogus and should be removed.  There is no reason to _not_ do the proper flipping that GL does in order to turn a _STRIP vertex sequence into a series of primitives.

Anyway here are some changes to the code that get quadstrips working:

diff -r 8a27b5093955 ObjFile.cpp
--- a/ObjFile.cpp       Mon Jan 14 12:51:18 2008 +0900
+++ b/ObjFile.cpp       Mon Jan 14 15:07:38 2008 +0900
@@ -145,11 +145,11 @@ void ObjFile::printSet(OGLE::ElementSetP

                        face->addElement(generateElement(set->elements[i]));

-                       if(i >= 3) {
+                       if(i >= 3 && (i%2)==1) {
                                printFace(face,
-                                       OGLE::config.flipPolyStrips     && (flip
_flag = (flip_flag + 1) % 2)
+                                       OGLE::config.flipPolyStrips
                                        );
-                               face->shiftElements(1);
+                               face->shiftElements(2);
                        }
                }
        }
@@ -170,11 +170,16 @@ void ObjFile::printFace(FacePtr face, bo
        if(!f) return;

        fprintf(f, "f ");
-       for(int i = (flip ? face->elements.size() - 1 : 0);
-                                       i < face->elements.size() && i >= 0;
-                                       i += (flip ? -1 : 1)) {
-
-               Element v = face->elements[i];
+       int N = face->elements.size();
+       for(int i = 0; i < N;  i++) {
+               int vi = i;
+               // For quadstrips and tri strips the rule for "flipping" is
+               // to flip the last two vertices.
+               if (flip) {
+                       if (i==N-2) { vi = N-1; }
+                       else if (i==N-1) { vi = N-2; }
+               }
+               Element v = face->elements[vi];

                fprintf(f, "%d", v.vid);