I need to create an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT, so that I can use
outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch
, but I can't figure out how to convert my CVImageBufferRef to an OpenGL texture. I'm sure I'm just no looking for the right thing. How can I convert an CVImageBufferRef to an OpenGL texture?
When I try:
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];
It tells me that 'name' cannot be null. I think that's because my imageBuffer is a pixel buffer, and not an OpenGL Texture. How can I create a OpenGL texture from my pixel buffer ?