Here it is…
My Wavefront OBJ Loader! It took me about two days to program this. It works perfect for me.
Here are the features:
-Allows you to load a model which uses both quads (4 vertexes) and triangles (3 vertexes), even if your model uses both quads and triangles simultaneously.
-No normals yet, sorry.
-Position, rotation, and scale.
-No textures yet - I’m still struggling with this.
Instructions for use:
To load an OBJ file, simply use the following command:
OBJRender model = OBJRender("your_model.obj");
After you have loaded your model, you must call the method render() to draw your model to the display (in your loop). Note that render() automatically calls glPushMatrix() before rendering the model and glPopMatrix() after, so it is not necessary to do this.
To control the position, rotation, and scale is very simple. The variables x, y, z, rotX, rotY, rotZ, scaleX, scaleY, and scaleZ are all public which allow you to alter the respective position, rotation, and scale. They should be self-explanatory, but if not, here’s a quick break-down:
x positions the model on it’s X axis.
y positions the model on it’s Y axis.
z positions the model on it’s Z axis.
rotX rotates the model around it’s X axis
rotY rotates the model around it’s Y axis
rotZ rotates the model around it’s Z axis
scaleX scales the model around it’s X axis.
scaleY scales the model around it’s Y axis.
scaleZ scales the model around it’s Z axis.
Theses values must be set before render() is called.
Get it here:
Source: http://www.gonavitch.info/OBJRender/OBJRender_v0.1_src.zip
Classes: http://www.gonavitch.info/OBJRender/OBJRender_v0.1.zip
Note: The source code is NOT commented!
Please post any comments, rants, or suggestions.
except he found a really cool one.