At first, it seemed obvious... Make 2 triangles per face wherever 4 indices were found, right?
Meaning, the following:
v 1.000000 1.000000 0.000000
v -1.000000 1.000000 -0.000000
v 1.000000 -1.000000 0.000000
v -1.000000 -1.000000 -0.000000
f -4 -3 -2 -1
... would, in turn, need to be converted into something like:
v 1.000000 1.000000 0.000000
v -1.000000 1.000000 -0.000000
v 1.000000 -1.000000 0.000000
v -1.000000 -1.000000 -0.000000
f -4 -3 -2
f -2 -3 -1
This particular example, of course, would render correctly.
However, not all cases are as simple as splitting the face into two faces (where the first face contains the first three vertices of the original face, and the second face contains the last 3 vertices, as per the above example). Take the following cube, for example:
v 0.000000 1.000000 1.000000
v 0.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v 1.000000 1.000000 1.000000
v 0.000000 1.000000 0.000000
v 0.000000 0.000000 0.000000
v 1.000000 0.000000 0.000000
v 1.000000 1.000000 0.000000
f 1 2 3 4
f 8 7 6 5
f 4 3 7 8
f 5 1 4 8
f 5 6 2 1
f 2 6 7 3
These faces cannot be split the same way in the previous example... So, I would need some way of knowing how to split a quadrilateral face into two triangle faces, whilst using the correct indices for the second face...
How can this be achieved? Please note that I am NOT using the fixed-function pipeline, and therefore, using GL_QUADS is NOT an option. My rendering engine is pretty much stuck on using GL_TRIANGLES only.