title: How to convert a CVImageBufferRef to an OpenGL texture
body: <p>I need to create an OpenGL texture of type GL_TEXTURE_RECTANGLE_EXT, so that I can use </p>
  
  <pre><code>outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch
  </code></pre>
  
  <p>, 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?</p>
  
  <p>When I try: </p>
  
  <pre><code>   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];
  </code></pre>
  
  <p>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 ?</p>