Opengl 中的相机
我对这个话题完全陌生。我想创建一个应用程序,让我可以操纵相机的像素(就像 Photobooth [在某种程度上])。如何将 xCode 中的基本 OpenGL ES 模板“转换”为一个可以看到(原始)相机的应用程序。有我可以使用的示例代码吗?我看到了 Brad Larson 的模板(ColorTracking),但无法用它做任何事情,因为我真的不知道该怎么做......这一切听起来可能毫无希望,但我如何学习 OpenGl?
谢谢,JNK
I am completely new to this topic. I would like to create an app which let's me 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不会直接回答你的问题,因为最好了解 OpenGL 的情况以及它是如何工作的,而不是仅仅将代码复制到 Apple 的示例项目中。
有许多可用于 OpenGL ES 的好资源,我想这取决于您的喜好。你可能不会从苹果开始,因为他们假设几乎所有与 GL 相关的东西你都已经知道/从其他地方学到了。大多数资源都会假设您熟悉 C(希望情况已经如此!)。
OpenGL ES 2.0 编程指南是一本特别好的书,有很多 iOS/iPhone 特定信息和代码示例 (http://opengles-book.com/)。也就是说,对 OpenGL(而不是 GL ES)的一般介绍可能对您更有用:许多相同的原则适用,并且在线和印刷版都有更多的资源。搜索有关“opengl 教程”的问题将为您提供指向正确方向的各种答案。
在非常高的水平上,您将希望使用 AVFoundation 从相机获取原始数据并将其应用到纹理,然后将该纹理映射到网格,然后您可以根据需要扭曲或使用该网格。
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.