我需要创建类型GL_TEXTURE_RECTANGLE_EXT的OpenGL的质感,让我可以使用如何将CVImageBufferRef转换为一个OpenGL纹理
outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch
,但我无法弄清楚如何我CVImageBufferRef转换为OpenGL纹理。我相信我只是没有找到正确的东西。我如何将CVImageBufferRef转换为OpenGL纹理?
当我尝试:
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];
它告诉我, '名称' 不能为空。我认为这是因为我的imageBuffer是一个像素缓冲区,而不是OpenGL纹理。我怎样才能从我的像素缓冲区创建一个OpenGL纹理?
我试过使用CVOpenGLTextureGetName(imageBuffer),它似乎返回null。我得到了'2011-11-20 12:23:52.607 Quartz Composer [18612:407] *** EXCEPTION IGNORED: - [CaptureWithDevice outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch:]:Argument当我运行它时,“name”不能为空' – Adam
在阅读你提到的另一个线程之后,我认为它返回null的原因是因为我的imageBuffer不是OpenGL缓冲区。所以,我仍然需要从像素缓冲区转换一个开放的GL纹理。 – Adam
啊,我明白了。那么你可以尝试原始数据路线。不幸的是,我没有做很多CoreVideo的工作。 – James