iPhone OpenGl : importing 3D models
General openGl question here. I guessing that to create 3D models to use with openGl-es I should use blender and save them as Obj. Do I have to make a parser or does openGl ES开发者_如何学C support a certain format? what about animations?
Open Asset Import Library can be used on the iOS and is licensed under the 3-clause BSD license.
Using blender to save your models as obj files is a great way to go, imo. OpenGL doesn't, to my knowledge, have any pre-built functionality or preference for certain file formats. You'll likely have to make your own parser to load the vertex data or, if you'd prefer, you can use one of the many .obj loaders others have written and posted online. I would recommend writing your own loader, however. It's fun and you'll learn a lot. Obj files are pretty easy, too. This might be a good starting point, if you just want to adapt pre-written code.
If you're still exploring 3D file formats though, I would recommend looking into Collada. It's an XML format and supports textures, vert weights, and even animations. There's also a plug-in available for blender. On the downside, it's a bit harder to find pre-made loaders out there and making your own takes a leap in difficulty from obj files. Sifting through Collada DOM should help get you well on your way, however, as it includes sample code for an OpenGL viewer and effects loader. The Khronos faq might get you started if you have tons of questions about the format.
精彩评论