Introduction
This tutorial will guid you through creating your own Wavefront .obj format model loader in OpenGL. The code has been written and compiled on Linux with SDL, LibDevil (for textures) and OpenGL, and should work with any system. Pre-compiled binaries
are supplied but have been compiled on an AMD Phenom II X6 64 bit, so you'll have to re-compile the loader for 32 bit systems.
What this tutorial will teach you
Or at least, what this tutorial hopes to teach you:
- How to write an object loader to load basic triangle mesh geometry: verticies, normals and faces.
- How to extend this loader with support for materials loaded from a
.mtlfile. - How to load textures into OpenGL for use with your models using LibDevil.
Future goals
In the future, I'd like to extend this tutorial with:
- A Vertex Buffer Object (VBO) draw method to vastly speed drawing up, and bring this loader out of the 1990s.
- Bump and specular map loading for a little more detail on the object.
Let's get started
If you want to write yourself a simple but functional and useful Wavefront object loader, read on. We'll get started with a little explanation of the file structure.