Importing Complex Objects 2 - Meshes with Materials

Bryson R. Payne, M.Ed.

An imported 3D castle with its original material colors preservedDiscussion:

In this last tutorial, we see one final element that can add a tremendous level of detail to our scenes without sacrificing too much speed. As in the previous lesson, we have an OBJ file being read in by the GLM toolkit. However, instead of "painting" the object with the current material color, this time we allow the original colors to be used in rendering the object. We do this efficiently by drawing the object once and saving it as a display list in OpenGL, the calling that display list in our rendering loop to show the object. Surprisingly few adjustments are made to achieve this astonishingly effective result. Look at the sample code in objects2 compared to the code in objects1, and you will see that it is actually just a little bit shorter. With the abundance of 3D meshes on the Internet, there is virtually no limit to the objects you can add to your virtual world using this method.

Sample code:

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

Executable example:

Click here for a running demo: objects2.exe, castle.obj, castle.mtl


Back to Main Tutorial Page

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