Skip to content

Instantly share code, notes, and snippets.

@Neill3d
Last active August 29, 2015 14:05
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 Neill3d/1fa04b0b0c4171dcf7de to your computer and use it in GitHub Desktop.
Save Neill3d/1fa04b0b0c4171dcf7de to your computer and use it in GitHub Desktop.
Convert OR SDK image clip format to opengl format
const FBVideoFormat clipFormat = (pVideoClip) ? (pVideoClip->Format) : kFBVideoFormat_RGB_24;
GLint internalFormat = (compressed) ? GL_COMPRESSED_RGB : GL_RGB;
GLint format = GL_RGB;
switch (clipFormat)
{
case kFBVideoFormat_Any:
printf( "%s - unsupported video format\n", pVideoClip->Name );
break;
case kFBVideoFormat_Other:
printf( "%s - unsupported video format\n", pVideoClip->Name );
break;
case kFBVideoFormat_RGBA_32:
internalFormat = (compressed) ? GL_COMPRESSED_RGBA : GL_RGBA8;
format = GL_RGBA;
break;
case kFBVideoFormat_RGB_24:
internalFormat = (compressed) ? GL_COMPRESSED_RGB : GL_RGB8;
format = GL_RGB;
break;
case kFBVideoFormat_BGRA_32:
internalFormat = (compressed) ? GL_COMPRESSED_RGBA : GL_BGRA;
format = GL_RGBA;
break;
case kFBVideoFormat_BGR_24:
internalFormat = (compressed) ? GL_COMPRESSED_RGB : GL_BGR;
format = GL_RGB;
break;
case kFBVideoFormat_BGR_16:
printf( "%s - unsupported video format\n", pVideoClip->Name );
break;
case kFBVideoFormat_ABGR_32:
internalFormat = (compressed) ? GL_COMPRESSED_RGBA : GL_ABGR_EXT;
format = GL_RGBA;
break;
case kFBVideoFormat_ARGB_32:
printf( "%s - unsupported video format\n", pVideoClip->Name );
break;
case kFBVideoFormat_422:
printf( "%s - unsupported video format\n", pVideoClip->Name );
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment