Skip to content

Instantly share code, notes, and snippets.

@avesus
Created October 19, 2014 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avesus/d81e68b2b0ca7e74558e to your computer and use it in GitHub Desktop.
Save avesus/d81e68b2b0ca7e74558e to your computer and use it in GitHub Desktop.
How to convert a CVImageBufferRef to an OpenGL texture
outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch
CVImageBufferRef imageBuffer = CVBufferRetain(mCurrentImageBuffer);
GLuint texture = CVOpenGLTextureGetName(imageBuffer);
id provider= [context outputImageProviderFromTextureWithPixelFormat:QCPlugInPixelFormatARGB8
pixelsWide:CVPixelBufferGetWidth(imageBuffer)
pixelsHigh:CVPixelBufferGetHeight(imageBuffer)
name:texture
flipped:NO
releaseCallback:_TextureReleaseCallback
releaseContext:NULL
colorSpace:CVImageBufferGetColorSpace(imageBuffer)
shouldColorMatch:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment