Reputation: 157
If I want to build an iPhone application that does image processing, should I start from the View-based Application project template or the OpenGL ES Application one? Can image processing be done in an application built using the View-based Application project template?
Upvotes: 0
Views: 1625
Reputation: 170319
As always, it doesn't really matter what template you choose when you start a new iPhone application project. These templates don't commit you to a particular development track, so you can always add the elements you need later on.
If you start with a View-based application, you can easily add an OpenGL ES layer and its hosting view later. Likewise, if you start from the OpenGL ES template, you can remove the UIView that hosts the OpenGL ES layer if you don't need it.
There's probably a slight advantage in starting with the OpenGL ES template, because it's easier to pull things out than add then in, but there isn't that much of an advantage in going that way.
The bigger question is: should you do your image processing on the GPU or CPU? That will dictate whether or not you need to use OpenGL ES. Using the GPU can give you a significant performance boost (from 14X - 28X in my measurements), but it adds some complexity. Apple has a great OpenGL ES image processing example in their GLImageProcessing sample, and I have a sample application that uses OpenGL ES 2.0 programmable shaders here. Otherwise, you can do pixel manipulation on raw data or using Core Graphics for CPU-based image processing without involving OpenGL ES.
Upvotes: 16