Camera in Opengl
I am completely new to this topic. I would like to create an app which let's m开发者_如何学运维e manipulate the pixels of the camera (like Photobooth [in a way]). How can I 'turn' the basic OpenGl ES template in xCode into an app where i can see the (raw) camera. Is there any sample code I could use? I saw Brad Larson's template (ColorTracking) but am not able to do anything with it, since I don't really know what to do... This all may sound hopeless, but how can I learn OpenGl?
thanks, JNK
This all may sound hopeless, but how can I learn OpenGl?
I'm not going to answer your question directly, because it's probably better to have an idea of what's going on with OpenGL and how it all works, rather than just copying code into Apple's sample projects.
There are a number of good resources available for OpenGL ES, I guess it depends what your prefer. The place you probably don't start is with Apple, because they assume pretty much anything GL related you'll already know / have learnt from elsewhere. Most resources will assume you're comfortable with C (hopefully this is the case already!).
The OpenGL ES 2.0 Programming Guide is a particularly good book, with a lot of iOS/iPhone specific information and code samples (http://opengles-book.com/). That said, a general introduction to OpenGL (rather than GL ES) will probably be more useful to you: a lot of the same principles apply, and there's considerably more resources both online and in print available. Searching for questions about 'opengl tutorials' will get you a variety of answers pointing in the right direction.
At a very high level, you'll be wanting to grab the raw data from the camera using AVFoundation and applying them to a texture, and then mapping that texture to a mesh which you can then distort or play with as you choose.
精彩评论