Import 3D objects and its animations in iphone openGL

I am trying to develop a 3D game in openGL and I need to create many 3D objects. I am a beggar in openGL. I tried using many 3D programs like Blender, MODO, Unity 3D and Cheetah.

I can easily create my objects with them and export as Wavefront.OBJ and convert it to a header file using a perl script. This header file is being added to my openGL project.

3D objects are visible but not perfect. The script I use is the conversion of .OBJ to .h using TRIANGLES .. And the object is visible with triangles. This is not complete. By no means when did I use TRIANGLE STRIP, FAN ..? Problems with vertices ..

Is there a problem with my script or is it the wrong way that I left .. ?? Or are there other better ways to directly import 3D objects into openGL .. ??

The following link is the best you can get for 3D objects for openGL .. I got scripts from these.

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

please, help..

+4
source share
2 answers

You do not want to go that way. Direct drawing mode (using TRIANGLE and friends) is extremely slow in OpenGL.

Instead, you should choose a decent format and write a loader for it (or use it on the Internet). Good formats would be 3ds, obj if gzipped, collada.

Here is an example tutorial when loading from Milkshape files.

Once you load your objects programmatically, you can use Vertex arrays or even better VBOs to display them. It's faster.

Google for mesh loader for your favorite format or write it yourself.

+1
source

I wrote a reader / render for AC3D files that work fine on iPhone (OpenGL ES)

Feel free to look at it here .

There is also a Jeff Lamarche obj downloader in Google code .

AC3D can reduce the number of triangles very well, and as an alternative, I ported QVis to mac. My reader / render is also trying to create three-stripes.

About VBO. I did not see any performance when using them on the iPhone. I am not the only one.

+1
source

All Articles