views:

227

answers:

2

I'd like to have a 3d object inside an iPhone UIView that can be rotated by using the touching events (swipe with a finger maybe). Where shall I start looking at? I guess OpenGL ES might be useful to do this, but I know nothing about it and I do not wanat to go deep inside OpenGL Programming ( studiying physics, rotations, quaternions etc) so maybe that is not what I need. I can create very basic 3d models in Blender so I'd like to use those in the app (I saw there are scripts that can parse and convert obj files in arrays of vertexes etc) Shall I rely upon a graphic engine like Irrlicht? Any suggestion is welcomed

A: 

you can look at a few things. Cocos2d-iphone is a good framework for 2d stuff. the templates they use are pretty good and set everything up. in cocos2d-iphone you can still draw opengl primatives (in the draw method) but also have the power of cocos2d to do things like sprites and other elements.

otherwise here is a quick guide for bringing in blender objects into an iphone project.

one thing that i noticed was with blender 2.5 alpha, i couldnt get the script to integrate properly so you just have to do that part manually. Just remember to convert your quads to triangles because thats what the iphone takes in.

AtomRiot
There is a good OpenGL es tutorial that just came back online. http://www.cocoachina.com/wiki/index.php?title=Category:Simon_Maurice_iPhone_OpenGL_ES
AtomRiot
+2  A: 

That is something I've done a few months ago. A friend that is a proper Objective-C developer said I should try the SIO2 engine.

Tutorial2 covers exactly what you are after.

alt text

Basically you build your scene in Blender and there is an exporter to get that in the SIO2 Game Engine on the IPhone, how awesome is that ? :)

To break it down:

  1. Open up the xcodeproject from Tutorial02
  2. Open up Blender (with a mesh)
  3. Run the Exporter(select the TextEditor in a Window, open sio2_exporter.py from SIO2_SDK/exporter and run)
  4. Select your mesh and hit export. You could backup tutorial02.sio and export a new one.
  5. In template.mm find the templateScreenTouchMove() method (towards the bottom) and update the mesh name

e.g. change

SIO2object *_SIO2object = ( SIO2object * )sio2ResourceGetObject( sio2->_SIO2resource,
                                                                         "object/Suzanne" );

to

SIO2object *_SIO2object = ( SIO2object * )sio2ResourceGetObject( sio2->_SIO2resource,
                                                                         "object/YourMeshName" );

It's all explained in the video tutorial as well.

Good luck!

George Profenza
Ty for the answer I'm gonna check it out and later comment here back
rano
@George Profenza, as promised I'm here back after experimenting SIO2, Irrlicht and OpenGL ES. I chose the last one, for that I was able to do a rotation in the 3d space more easily and fluidly. By the way thanks, I point this as the correct answer ^^
rano