tags:

views:

559

answers:

2

I am trying to develop a 3D game in openGL and i need to create many 3D objects.. I am a begginner in openGL.. I have tried with many 3D softwares like Blender , MODO, Unity 3D and Cheetah.

I am easily able to create my objects with these and exporting as Wavefront .OBJ, and converting it to a header file using a perl script. This header file is added to my openGL project..

The 3D objects are seen, but its not perfect. The script i used is to convert the .OBJ to .h using TRIANGLES.. And the object is seen with triangles. Its not full.. No way when i used TRIANGLE STRIP,FAN..? Problems with the vertices..

Is the problem with my Script or is it the wrong way i have gone..?? Or is there any other best ways to directly import 3D objects to openGL..??

The below link is the best one which you can get for 3D objects to openGL.. i got the scripts from these..

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

please help..

+1  A: 

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

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

Here's an example tutorial on loading from Milkshape files.

Once you load your objects programatically, you can use Vertex Arrays, or even better VBO's to display them. This is waaay faster.

Google for a mesh loader for your favorite format, or write one yourself.

Kornel Kisielewicz
Thanks for your reply. I am using blender for creating 3D object animation. I dont have milkshape 3D. So is it some how possible to import the animated file to opengl.? Is Collada a good format for that. Or can you help me out in that..Thanks once again..
quint
+1  A: 

I have written a reader/renderer for AC3D files that works fine on the iPhone (OpenGL ES)

Feel free to have a look at it here.

There is also an obj loader by Jeff Lamarche at google code.

AC3D can reduce the triangle count pretty good and as an alternative I ported QVis to the mac. My reader/renderer also tries to build tri-strips.

About VBO's. I have not seen any gained performance when using them in the iPhone. I'm not the only one.

epatel
Thanks for your reply.. I havnt tried with AC3D yet. Dint get its full version yet. But i am trying to do the creation with Blender, which is much better i suppose. So is there any way to import the animation form blender to opengl codes.. Or any other direct ways to do that.. Please help
quint