The EXT_packed_pixels extension

When creating a texture in OpenGL 1.1, the data is presented in a component-per-data-type format, where the data type is most commonly GL_UNSIGNED_BYTE.  Hence a 4-component texture is downloaded as four bytes.  However, artwork is often stored in a 16-bit format, thus the application must expand the data to 32-bit before calling glTexImage2D().  Worse, if the texture will be stored as 16-bit internally, the driver must undo the expansion which the application went through so much effort to perform.

OpenGL 1.2 addresses this issue by introducing a rich set of new data types which are recognized by imaging operations including glTexImage2D() and glDrawPixels().  At the time this document is being written, there are no implementations of OpenGL 1.2 available in the consumer space.  However, many implementations support an extension called EXT_packed_pixels which, while less flexible than the OpenGL 1.2 equivalent, offers much of the same functionality.  The following types are particularly noteworthy (others are supported; see the spec for details):

GL_UNSIGNED_SHORT_4_4_4_4_EXT
GL_UNSIGNED_SHORT_5_5_5_1_EXT
These enumerants, when supplied as the type parameter, indicates that the data is a packed 16-bit per pixel/texel.  This setting is independent of the "internalformat" parameter, but is most commonly used with the corresponding internal formats GL_RGBA5 and GL_RGB5_A1, respectively.

If your data is store in 16-bit format, this extension may simplify the work needed to download a texture both by the application and the driver, hence improving texture download performance.



Copyright (c) 1999, Michael I. Gold