
Boris B. answered 05/28/19
Expert Mechanical Design Engineer, (English-Russian)
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 < 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.
The best workflow (and answer to this question) would be as follows:
Export the CAD models to Wavefront OBJ format
Integrate the fixed-pipeline rendering implementation of open-source OBJ viewer into the code base.