9

Since OpenGL doesn't have any function like GLLoadObjFile('myModel.obj');, What's the best tutorial to load a 3d model file like .obj in a iOS app?

I've tried the wavefront loader but it doesn't seem to be working.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
ManOx
  • 1,935
  • 5
  • 23
  • 37

3 Answers3

7

https://github.com/jlamarche/iOS-OpenGLES-Stuff/tree/master/Wavefront%20OBJ%20Loader

It's loader seems pretty decent, supporting even materials from blender, though it uses OpenGL ES 1, the loader classes should work perfectly in ES 2

TheAmateurProgrammer
  • 9,252
  • 8
  • 52
  • 71
  • It didn't seem to work when I tried it. However I will say that I don't know much about OpenGL ES 1 or 2. So, do you know of a tutorial or documentation for this Xcodeproj? – ManOx Jul 16 '12 at 04:10
  • Wait, if you don't know much about OpenGL ES 1/2, then what are you doing with the obj file? – TheAmateurProgrammer Jul 16 '12 at 04:12
  • Long story short, I would like to display a .obj file I have created via Blender inside a UIView (if that's even possible). – ManOx Jul 16 '12 at 04:22
  • Don't think that's possible. Did a quick google search, and everything points towards using OpenGL ES. You'll have to learn a bit of OpenGL, unfortunately. – TheAmateurProgrammer Jul 16 '12 at 04:27
  • Yeah... That's what I figured. Maybe I'll just get someone who's proficient in Open GL. THanks! – ManOx Jul 16 '12 at 19:18
4

I have used a library called Ninevegl. It is pretty good and supports file formats like .obj and .dae. It is very easy to use and they have nicely explained documentation. Here is the link.

http://nineveh.gl/downloads/

Rishabh Tayal
  • 497
  • 7
  • 15
  • hey @rishabh I am interested in using NGLMesh class with pure opengl es. I dont want to use NGLCamera or any other classes. I just need its asset loading features. Can you please help me how to use this class with pure open gl es or/and using GLKit. – Ali Arslan May 08 '15 at 13:09
  • I gave a change to NinevehGL and it's a nightmare to move an object... will look for another framework – Rafael Ruiz Muñoz Nov 15 '15 at 16:13
1

I built a Perl/Xcode project for loading .obj and .mtl files into OpenGL ES 2.0 on iOS, available here. It's called mtl2opengl and you can see comments/results from other S.O. users in these similar questions:

  1. opengles display human face in iphone
  2. ios : Displaying a simple 3D model with GLEssentials sample code
  3. How to convert Blender blend (or obj) file to Qualcom Vuforia .h file
Community
  • 1
  • 1
Ricardo RendonCepeda
  • 3,271
  • 4
  • 23
  • 30