Home » Android » 3d – Android OpenGL .OBJ file loader

3d – Android OpenGL .OBJ file loader

Posted by: admin April 23, 2020 Leave a comment

Questions:

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.

How to&Answers:

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.

Answer:

I know this is an old question, but I have encountered some problems to find a good OBJ loader for Android.

I tried almost all the solutions proposed

  • Min3D which is quite old (last revision is from 2011)
  • Rajawali which seems to be a fork of min3D
  • Libgdx which is a game engine
  • JPCT-AE a 3d engine for android

The only one that wasn’t too complicated and worked was JPCT-AE, that can be found here : http://www.jpct.net/jpct-ae/

It allows parsing OBJ files, and loads the textures from the associated MTL file without any problem. Moreover the documentation is really descriptive compared to others, and there is a forum with a lot of questions answered.