Using the OBJ Loader

To demonstrate the OBJ loader, I've rewritten the last example and created a new test called ObjTest along with an ObjScreen. I copied over all the code from the previous example and only changed a single line in the constructor of ObjScreen:

cube = ObjLoader.Iood(glGame, "cube.obj");

So, instead of using the createCube() method (which I removed), we are now directly loading a model from an OBJ file called cube.obj. I created a replica of the cube we previously specified programmatically in createCube() in Wings3D. It has the same vertex positions, texture coordinates and normals as the handcrafted version. It should come as no surprise that when you run ObjTest it will look exactly like our EulerCameraTest. I'll therefore spare you the obligatory screenshot.

0 0

Post a comment