Importing Complex Objects 1 - 3D Meshes

Bryson R. Payne, M.Ed.

A complex table OBJ file imported into our sceneDiscussion:

As with almost everything else, there are numerous ways to add complex 3D models to your OpenGL world. One very simple way to add 3D models involves using the GLM toolkit, available at http://romka.demonews.com/opengl/utils/index_eng.htm. In this sample program, you can see that just a few lines of code needed to be changed in order to achieve a fairly complex result. We added just a handful of simple commands like glmReadOBJ and glmDraw to put a somewhat intricate one-color table into our scene. The table itself is saved as an OBJ file (Alias Wavefront format), converted from a 3DS (3D Studio Max) model from http://www.3dcafe.com with the 3D Exploration software from http://www.xdsoft.com/explorer/. With the GLM toolkit, you can import any 3D object easily into your virtual worlds for extremely fine detail without excessive work. In this example, we control the color of the table with the normal glColor3ub or glColor3f call. In the final lesson, we will see how to display an OBJ model with the original material colors used to create it.  

Sample code:

Click here to see the sample code: objects1.c, glm.h

Executable example:

Click here for a running demo: objects1.exe, table.obj, table.mtl


Back to Main Tutorial Page

Last modified December 11, 2000, Bryson R. Payne, bpayne@ngcsu.edu