I am making a simple OBJ loader that basically works like this. I parse the text file and store all the vertices/normals/faces etc in some data structures. Then in my draw function I extract the faces and make array lookups based on the positions given by the faces. I originally had implemented the Draw function to just draw quads but when I wanted to make my program work with faces of any number of vertices I had to switch to polygons and this killed my efficiency. My original code was something like this (The pseudo code is based on common lisp but its pretty basic so should be okay):
loops to extract and draw
But since now my new code has to accept faces of any number it looks more like this:
//end of loops
I think because I am beginning and ending the polygon every loop cycle instead of building the draw list and drawing at the end I am killing my frame rate ( it dropped by a factor greater then 10). Is there a way I can just start the GL_polygon before the loop and then every time through just tell it how many vertices to expect then end the polygon after my loop? Or is there some other more efficient way to do this? Thanks.