How to convert a 3D model into an OpenGL fixed pipeline representation I have a CAD model in Solidworks (which can be converted to STL, OBJ, STEP , VRML etc.) that I need to render in an old application, which still uses fixed pipeline.

Ideally, I would like to convert my model into a series of glMaterialfv, glBegin, glVertex3f, glEnd commands that I can compile directly into a C library so that I can avoid loading data from an external file. If this approach will be too painful, however, perhaps someone could alternatively suggest an open-source lightweight fixed pipeline model renderer that I can embed into my code.
You can compile it into a 

Vertex vertices[] = {{posx, posy, posz, texu, texv, ..}, 
                     {posx, posy, posz, texu, texv, ..}, 
                     //...
                    }


and then loop over them:

glBegin(GL_TRIANGLES);
for (int i = 0; i &lt; arraycount(vertices); i++){

    glTexCoord2f(vertices[i].texu, vertices[i].texv);
    //... 
    glVertex3f(vertices[i].posx, vertices[i].posy, vertices[i].posz);
}
glEnd();


Another solution would be to mimic what the modern vertex buffer based solutions do by creating a VertexAttributeLayout struct and setting it up. Then in the loop you interpret the layout struct and interpret the data as needed.