Android OpenGL .OBJ file loader

Matt Huggins picture Matt Huggins · Jul 2, 2010 · Viewed 62.8k times · Source

There seem to be quite a number of OBJ mesh file loaders out there that people have developed for use on the Android platform. I'm wondering if anyone has any experience with these and can offer a recommendation on which one seems to work best for them.

Here are my criteria:

  • Lightweight (small file size),
  • Optimized for speed,
  • Easy to implement,
  • Offers some sort of texture mapping support (not sure if I need this -- haven't gotten far enough in my coding to know if I need a library to do this, or if OpenGL ES will be able to do all that work I need here), and
  • Can be used in Android apps that are being sold commercially.

Here are a few of the libraries I've found.

I'm also open to hearing about others not included on this list.

Answer

Matthew Mitchell picture Matthew Mitchell · Aug 30, 2010

You asked this a while back but I have a good solution if you are still looking.

Instead of loading an obj file, you can easily convert it into arrays for the vertices, normals and texture coordinates. There's a tool which converts obj files to c header files. You can convert the output to work with java afterwards. It shouldn't be hard.

http://www.heikobehrens.net/2009/08/27/obj2opengl/

This solution is easy, the header files wont add much space in source code than the obj files and the data will be more compact when compiled, it's very fast since you have the data there ready to render straight away, it can convert texture coordinates and you don't need to worry about using it for your commercial products.