views:

10648

answers:

9

I want to display and rotate a single 3D model, preferably textured, on the iPhone. Doesn't have to zoom in and out, or have a background, or anything.

I have the following:

  • an iPhone
  • a MacBook
  • the iPhone SDK
  • Blender

My knowledge base:

  • I can make 3D models in various 3D programs (I'm most comfortable with 3D Studio Max, which I once took a course on, but I've used others)
  • General knowledge of procedural programming from years ago (QuickBasic - I'm old!)
  • Beginner's knowledge of object-oriented programming from going through simple Java and C# tutorials (Head Start C# book and my wife's intro to OOP course that used Java)
  • I have managed to display a 3D textured model and spin it using a tutorial in C# I got off the net (I didn't just copy and paste, I understand basically how it works) and the XNA game development library, using Visual Studio on Windows.

What I do not know:

  • Much about Objective C
  • Anything about OpenGL or OpenGL ES, which the iPhone apparently uses
  • Anything about XCode

My main problem is that I don't know where to start! All the iPhone books I found seem to be about creating GUI applications, not OpenGL apps. I found an OpenGL book but I don't know how much, if any, applies to iPhone development. And I find the Objective C syntax somewhat confusing, with the weird nested method naming, things like "id" that don't make sense, and the scary thought that I have to do manual memory management.

Where is the best place to start? I couldn't find any tutorials for this sort of thing, but maybe my Google-Fu is weak. Or maybe I should start with learning Objective C? I know of books like Aaron Hillgrass', but I've also read that they are outdated and much of the sample code doesn't work on the iPhone SDK, plus it seems geared towards the Model-View-Controller paradigm which doesn't seem that suited for 3D apps.

Basically I'm confused about what my first steps should be.

+6  A: 

You should probably start with some simpler iphone apps/tutorials, just to get your footing on obj-c and xcode etc.

For that, I recommend the pragmatic programmer's iphone book, which has enough information to get started (I started with no knowledge of xcode, obj-c, iphone or mac and got to a working app fairly fast, using mainly this). However I should add that I come from a fairly good background in C/C++ and Java.

For your particular project, perhaps take a look at this answer which refers to an open source 3D app that you can look at and get tips from.

frankodwyer
+10  A: 

Once again, if I may plug my own work, I have written a post about the things I've learned from developing an OpenGL ES application on the iPhone. That application, Molecules (referred to by frankodwyer), is open source and I have a writeup on some of the other tricky issues I ran into while developing it. The application generates 3-D models and lets you rotate and scale them with your fingers, which sounds close to your needs. You can download the code, compile it, and run it on your desktop in a matter of a few minutes. If you join the iPhone Developer Program, you can install it on your device.

When it comes to object loading, Bill Dudney is working on a Wavefront OBJ loader for the iPhone that might be able to take in your Blender files, should they be exportable in that format. I haven't done much texture work on the iPhone yet, but it sounds like his example has that working now.

Overall, I find that learning by example and by jumping into development of some small, targeted applications (that you may never release) are what works for me. Try tweaking the examples listed above and see what happens. You should be able to read through the Objective-C code in those examples and start to get a feel for what they're doing.

Even though Hillegass's book (the third edition just came out and is up-to-date) focuses on the Mac, the Cocoa fundamentals he teaches are still relevant for the iPhone. The MVC design pattern serves you just as well on the iPhone as the Mac. I actually deviated from that pattern in a few places within Molecules, and I regret that decision because those sections of the application became a mess. The book is an easy read and well worth your time.

Brad Larson
+1  A: 

I'm having a play with iPhone development for a bit of fun and bought Beginning iPhone Development by Dave Mark and Jeff LaMarche (ISBN13: 978-1-4302-1626-1) and am enjoying working through the chapters. I have a Win32 Delphi background with a bit of .NET and so Objective C is very new to me.

One of the chapters is on OpenGL and Quartz which may be of interest to you. I've haven't got that far yet so I can't really comment on how useful it will be for yourself but the writing style is very accessible and it's paced well (for me anyway).

The initial chapters explain exactly how to get up an running with a good introduction to Xcode and InterfaceBuilder.

Simon Temlett
A: 

2 good 3d sdks for iphone:

sio2interactive and oolong.

The sio2interactive has great video and src tutorials on their site. It will help with blender and model export and render - gets you to right to game development. The src is all in c for sio2 and the code is commented very well. It is a great place to begin learning 3d and opengles. Blender to sio2 export is WYSIWYG.

Doing all this from scratch and you will have to know how to export and import the models yourself. So both great libs for someone getting started.

A: 

Shameless plug

I have made a small AC3D renderer for the iPhone. Link>>

Feel free to try it out, a demo lib for the iPhone simulator is available. Please note that the OpenGLES performance on the iPhone is not the same as in the Simulator.

It uses a optimization stage and build tristrips and builds final vertexarrays to be able to run on the iPhone.

Watch a quickstart how to use it

epatel
A: 

hi the molecules app looks great. Just wondering, what format do the models have to be in?

sdb
This should have been a comment on my answer, which is why I'm only seeing it now. The PDB format is the only supported molecular model type currently, but I'm working on others.
Brad Larson
Are there texturing problems for more complicated models -- say a human face?
ina
A: 

if y want 3d model then http://www.rafeec.com/

3d-labs
A: 

Buy UNITY3D. http://www.fuzzy3d.com/3D_real-time/iphone/iphone.htm

fuzzy3d
so by just buying a large out of the box engine, how does the QA learn? (which is what this question seems to be aimed at)
geocoin
A: 

The only real and true solution, to the question posed, is to just buy Unity3D.

It costs nothing - less than the cost of a Mac or a couple monitors. It's essentially the only real way to do what you are trying to do.

If for some particular reason you try to avoid buying Unity3D, you are going to spend AT LEAST 3 months of your time fooling around with other stuff that is ultimately totally irrelevant to you. In that time you could have made $20-$50 thousand just doing boring freelance, so it just cannot be the case that the very low price of Unity is a problem.

Conversely, you are simply gonna have to become basically extremely proficient at XCode/ObjectiveC development ... before you can even get in to the OpenGL aspect. Are you really able to dedicate 3 or 6 months of your life to that - and why?

It's difficult to see that there's any solution to the actual question you are asking, other than buy Unity3D. If you buy it this afternoon, by tomorrow afternoon you will be able to do everything you will ever want to do with models from blender. Hell, the 30 day trial is completely free I think - in that time you'll do everything you'll ever want to do with it.

Tip - to use Unity you must buy a 3button mouse for ten bucks, or at least the Mac two-button magic mouse!

Joe Blow