Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

objective c - How to load IOSurface in OpenGL for Mac OS X Snow Leopard application

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.

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

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.

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.

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

Much appreciated.

p.s.

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

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

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...