code is for reading i-th pixel. a-value isn't used by MPlayer the definition of OpenGL values can be found in e.g.: The OpenGL Graphics System: A Specification (Version 1.3) glspec13.pdf, around pages 94-100 in their numbering (106-112 in gv) RGB32: gl format: GL_RGBA gl type: GL_UNSIGNED_BYTE code: uint8_t *data; r=data[4*i]; g=data[4*i+1]; b=data[4*i+2]; a=data[4*i+3]; =========================== RGB24: gl format: GL_RGB gl type: GL_UNSIGNED_BYTE code: uint8_t *data; r=data[3*i]; g=data[3*i+1]; b=data[3*i+2]; =========================== RGB16: gl format: GL_RGB gl type: GL_UNSIGNED_SHORT_5_6_5 code: uint16_t *data; r=(data[i] & 0xf800) >> 11; g=(data[i] & 0x07e0) >> 5; b=(data[i] & 0x001f); =========================== RGB15: gl format: GL_RGBA gl type: GL_UNSIGNED_SHORT_5_5_5_1 code: uint16_t *data; r=(data[i] & 0xf800) >> 11; g=(data[i] & 0x07c0) >> 6; b=(data[i] & 0x002e) >> 1; a=(data[i] & 0x0001); =========================== RGB8: gl format: GL_RGB gl type: GL_UNSIGNED_BYTE_3_3_2 code: uint8_t *data; r=(data[i] & 0xe0) >> 5; g=(data[i] & 0x1c) >> 2; b=(data[i] & 0x03); =========================== BGR32: gl format: GL_BGRA gl type: GL_UNSIGNED_BYTE code: uint8_t *data; b=data[4*i]; g=data[4*i+1]; r=data[4*i+2]; a=data[4*i+3]; =========================== BGR24: gl format: GL_BGR gl type: GL_UNSIGNED_BYTE code: uint8_t *data; r=data[3*i]; g=data[3*i+1]; b=data[3*i+2]; =========================== BGR16: gl format: GL_RGB gl type: GL_UNSIGNED_SHORT_5_6_5_REV code: uint16_t *data; b=(data[i] & 0xf800) >> 11; g=(data[i] & 0x07e0) >> 5; r=(data[i] & 0x001f); =========================== BGR15: gl format: GL_BGRA gl type: GL_UNSIGNED_SHORT_5_5_5_1 code: uint16_t *data; b=(data[i] & 0xf800) >> 11; g=(data[i] & 0x07c0) >> 6; r=(data[i] & 0x002e) >> 1; a=(data[i] & 0x0001); =========================== BGR8: gl format: GL_RGB gl type: GL_UNSIGNED_BYTE_2_3_3_REV code: uint8_t *data; b=(data[i] & 0xc0) >> 6; g=(data[i] & 0x38) >> 3; r=(data[i] & 0x07); ---------------------------------------------------- *************************************************** ================================================== currently different in MPlayer (tested only for little endian!): RGB16, would be BGR16 in OpenGL RGB15: gl format: GL_RGBA gl type: GL_UNSIGNED_SHORT_1_5_5_5_REV code: uint16_t *data; a=(data[i] & 0x8000) >> 15; b=(data[i] & 0x7c00) >> 10; g=(data[i] & 0x03e0) >> 5; r=(data[i] & 0x001f); RGB8, would be BGR8 in OpenGL, see postproc/rgb2rgb.c line 595 BGR16, would be RGB16 in OpenGL BGR15: gl format: GL_BGRA gl type: GL_UNSIGNED_SHORT_1_5_5_5_REV code: uint16_t *data; a=(data[i] & 0x8000) >> 15; b=(data[i] & 0x7c00) >> 10; g=(data[i] & 0x03e0) >> 5; r=(data[i] & 0x001f); BGR8, would be RGB8 in OpenGL