Many OpenGL users already have written code to do this, and in some cases, the code is available on the Web. A few are listed here. If you can't find what you are looking for, you might try doing a Web search. This file format information covers a variety of different file formats. Okino's PolyTrans can convert most major 3D file formats into OpenGL C code.
Demos are available on their Web site.
3DWinOGL is shareware that reads in any file format and returns OpenGL primitive data. The XGL file format is intended to be capable of storing all OpenGL 3D information. An open source parser and a 3DS file converter are available. The file glm.c contains routines for reading in Wavefront OBJ files. A 3DS import library in Delphi designed for use with OpenGL can be found here .