Friday, December 26, 2008

Almost There...

As you can see from the screenshot above, I've got the texture mapping almost working in the Wavefront OBJ file loader. It took me a while to get the vertices and texture coordinate algorithm working thanks to a bug I had made earlier and mistakenly thought was introduced by the algorithm.

The cube that is working correctly in the screenshot above has a single image mapped separately to each of the six sides. The one that's not showing up has a single UV-mapped image that wraps around the entire image.

I'm hoping to have the completed version posted in a few days.


tobydeh said...
This comment has been removed by the author.
tobydeh said...

Hey great work, this is looking really good.

I've been playing around and it doesnt like certain models. Only half of the triangles are drawn if that makes sense? It seems like each "square" is only showing half of its face in the form of a triangle..

Try this Magnolia model to see what i mean:

Just thought id let you know

Jeff LaMarche said...


I'm honestly not surprised - I've only been able to test OBJ's exported from Blender.

Looking at the OBJ file you sent, the problem with this particular file is that it's not all triangles - there are several faces that have more than three sides. OpenGL ES can't support quads and it doesn't make sense to do triangulation at runtime if you're creating content for a game or other program, so this program assumes that the file has been exported in a particular way - with only triangles.

After importing it and exporting it with the "triangulate" option, it looks fine.

papillon68 said...

Looking forward to final version, excellent work indeed. I'm going to put a link from my blog to this website, which is the best I found so far about Iphone development.
Thanks for your hard work and for sharing this excellent loader.