如何在 OpenGL 中为 Mac OS X Snow Leopard 应用程序加载 IOSurface

How to load IOSurface in OpenGL for Mac OS X Snow Leopard application(如何在 OpenGL 中为 Mac OS X Snow Leopard 应用程序加载 IOSurface)

本文介绍了如何在 OpenGL 中为 Mac OS X Snow Leopard 应用程序加载 IOSurface的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple 在 10.6 Mac OS X 固件更新中添加了新的 IOSurface 框架.由于这个框架相对较新,我还没有找到关于如何正确使用它的急需文档.

Apple added the new IOSurface framework as part of the 10.6 Mac OS X firm update. Since this framework relatively new, I haven't found the much need documentation on how to properly use this.

我想知道 StackOverflow 上是否有人可以帮助我使用 IOSurface.

I was wondering if there anyone on StackOverflow that can assist me with IOSurface usage.

无论如何,这就是我想做的.现在我的应用程序非常简单,因此我可以熟悉 IOSurfaces.所以本质上,我想将图像加载到 IOSurface 纹理中并在自定义 OpenGLView 中显示.这就是我目前的目标.

Anyways, this is what I want to do. Right now my application is very simple so that I can become familiar with IOSurfaces. So essentially, I would want to load up an image into an IOSurface texture and display in a custom OpenGLView. That's all I am aiming for at this point.

为了使这更简单,我只在 IOSurface 中加载一种常量颜色.我此时的主要目标是创建一个 IOSurface 引用并在自定义 OpenGL 视图中显示.

To make this more simple, I just load one constant color in the IOSurface. My main objective at this point is to create an IOSurface reference and display in a custom OpenGL view.

请帮帮我-IOSurface声明声明- 将数据加载到 IOSurface- 以及在 OpenGL 中绘制 IOSurface 的语法.

Please help me with -IOSurface declaration statements -Loading data into the IOSurface -and the syntax for drawing the IOSurface in OpenGL.

非常感谢.

附言

IOSurface 就像一个内存管理器,在应用程序之间传递图形数据或类似的东西.

IOSurface is like a memory manager that passes graphic data between applications or something a long the line of that.

我已经尝试过 Google IOSurface.最有帮助的网站是

I have tried Google IOSurface. And the most helpful site is

http://cocoadhoc.blogspot.com/2009/09/hidden-gems-of-snow-leopard-iosurface.html

但是,当我尝试编译示例代码时,我遇到了一个编译器错误,指出 QTVisualContextRef 和其他 QuickTime 变量未声明.我通过自动更新获得了最新版本的 Quick Time.

However, when I tried compile the example code, I have a compiler error stating that QTVisualContextRef and other QuickTime variables undeclared. I have the latest version of Quick Time through the automatic update.

推荐答案

IOSurface API 与 Core Video 的 CVPixelBuffer 非常相似,有文档说明,所以你可以从 CVPixelBuffer 文档并与 IOSurfaceAPI.h 进行比较.

The IOSurface API is quite similar to Core Video's CVPixelBuffer, which is documented, so you could start by looking at the CVPixelBuffer documentation and comparing with IOSurfaceAPI.h.

要将 OpenGL 纹理绑定到 IOSurface,请参阅在 <OpenGL/CGLIOSurface.h> 中定义的 CGLtexImageIOSurface2D 函数.

To bind an OpenGL texture to an IOSurface, see the CGLTexImageIOSurface2D function, which is defined in <OpenGL/CGLIOSurface.h>.

这篇关于如何在 OpenGL 中为 Mac OS X Snow Leopard 应用程序加载 IOSurface的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何在 OpenGL 中为 Mac OS X Snow Leopard 应用程序加载 IOSurface

基础教程推荐