mepic.png

Home

Guides

Current Projects
PacManGL
Untitled iPhone Project

Demos
2.5D Engine
OBJ Model loader
Two Hairy Men
Physics Demos
Journey To Castle Sunshine
Another Blue Hedgehog

About Me

Contact

BrainDeadClown.com

 

OBJ Model Loader

In my free time I have written my own OBJ Model Loader. In order for it to work the models myst be exported from Blender as a OBJ with the following settings.
File -> Export -> Wavefront(*.obj)

Blender
Blender Settings
You only really need to change to the Export and Blender Objects as OBJ settings

Here are some screens of the current version of my OBJ Model Loader. It will load verticies, normals and colour materials from the corresponding *.mtl file of the Object. In OBJ_Loader v2.3 I have used vector and index arrays to draw the object. Unfortunately you loose use the normals when you do this, and you will see when you run the program that it reacts very poorly to lighting.

Dark Model

Bright Model
Too Dark
Have to tilt forwad to get looking ok-ish

I have made a verision of ths program that runs on the iPhone, but rather than use Lighting and Materials I just colour the different parts of the model. I use the Diffuse colur as glColor4f(r,g,b,a) so the image will appear in the correct way, allow slightly toonish with no Shading or Lighting effects (running in iPhone Simulator below).

OBJ Model Loader

In an earlier build, OBJ_Loader v2.0, of the program using glBegin() and glEnd() I have the model loading with the normals exported from Blender. This gives a more "3D" feel and look to the model but it is not as efficient as rendering them as the method used in the more recent version of the program. As these functions are not in OpenGL ES I cannot get this to work on the iPhone.

OBJ Normals 1
OBJ Normals 2

Versions for Download

Version      
OBJ_Loader_v2.3
Xcode
VS08
OBJ_Loader_v2.0
Xcode
VS08
Cpp Files
OBJ_Loader_iPhone_v1.0
iPhone Code

 

 

 

 

 

 

david.bogues@braindeadclown.com