Search code examples
opengltexturesspecificationsopengl-4

Textures using different data types for different components


The OpenGL 4.5 doc and spec mentions the existence of parameter names GL_TEXTURE_RED_TYPE, GL_TEXTURE_GREEN_TYPE, GL_TEXTURE_BLUE_TYPE, GL_TEXTURE_ALPHA_TYPE, GL_TEXTURE_DEPTH_TYPE for glTextureLevelParameter*, saying that they return the data type of each separate component. I understand the appeal for depth and stencil components, but what about RGBA ? Is it possible to have a texture, say for the sake of the argument, with signed int red, float green, unsigned int blue and signed fixed alpha ? Or are red, green, blue and alpha components guaranteed to always return the same data type ? Not sure how one would request such an internal format to a texture to begin with.

Note that I understand the point of GL_TEXTURE_RED_SIZE, GL_TEXTURE_GREEN_SIZE, GL_TEXTURE_BLUE_SIZE, GL_TEXTURE_ALPHA_SIZE, GL_TEXTURE_DEPTH_SIZE, notably for formats like R5G6B5 or RGB10A2.


Solution

  • There are no internal formats that allow different color components to have different types. In theory, the querying API allows for it, but there are to my knowledge no internal formats that allow for it.