CVImageBufferRef to OpenGL

Has anyone managed to turn a CVImageBufferRef into an OpenGLES texture? I´ve tried using:

glTexImage2D(GL TEXTURE2D, 0, GL_RGBA, width, height, 0, GL_BGRA, GL UNSIGNEDINT, CVPixelBufferGetBaseAddress(image));

but the texture comes out completely black. Any help?

IPhone 3GS, iOS 4, none

Posted on Sep 29, 2010 9:38 AM

Reply
1 reply

Oct 10, 2010 5:33 AM in response to Arkano

I think you should just be able to use CVImageBufferRef directly as a texture:

CVImageBufferRef image;
...
glBindTexture( CVOpenGLTextureGetTarget( image ), CVOpenGLTextureGetName( image ) );

This certainly works for me in a modified version of Apple's QTCoreImage101 example, but I'd be interested to know if it is considered completely safe.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

CVImageBufferRef to OpenGL

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.