iPhone Development #2
June 10, 2009
Last month I decided to bite the Apple and start work on my first iPhone app – making the transition from the relative confines of Processing and Java, into the stark reality of C++, Objective C, Cocoa, OpenGL ES and MAC OS-iness.
Well, I’m 3 weeks in and finally getting somewhere, but not after some duly expected stress.
I’ve managed to get my ‘Zeno’ algorithm up and running, which is the basis of my recent animations using Processing/Java, namely Music Is Math, Metamorphosis, Swan Lake and The Nest That Sailed The Sky.
My first task was teaching myself C++/Objective C, and getting familiar with the Xcode IDE.
- writing in Objective C requires more lines of code for almost everything.
- OOP programming much more methodical and less intuitive.
- Basic functions I’ve taken for granted like Perlin Noise I’ve had to implement myself! Yes I had to actually learn all the math involved to get it working. Took me a few days to figure out, but it’s time I’d rather not have wasted at this stage.
- Xcode wont allow you to quickly save copies of projects, – to accommodate experimental branching of coding ideas. It does have a ‘snapshots’ feature, but I don’t really like it.
- Memory management – everything needs to be allocated and released by the programmer, a real pain to learn.
- Programming in OpenGL ES is far from quick and intuitive, lots and lots of code that just sets it up, thankfully I was using pre-made templates.
- generally a VERY steep learning curve for all of the above.
- Xcode is great for debugging, typing in code.
- Objective C generally more dynamic and powerful I think.
- Forces you to think very clearly about management of project, source files and structure of what you’re doing, good in the long run.
So at this stage I’m feeling happier and more confident about realising my first iPhone app. My plan is to take Metamorphosis and create a real-time/interactive version based exactly on the animation seen in the video. There’s plenty of work to do yet obviously, there will be a lot of particle,shading effects to be built in, and probably strenuous optimisation. But I’m looking forward to the task at hand.