Search code examples
opengltexturesrgbopengl-4image-unit

OpenGL Image Load/Store 24-bit RGB images


It looks like glBindImageTexture does not have an image format for 24-bit RGB (3 8-bit channels) images. My texture has an internal format of the type GL_RGB8 (a 24-bit RGB image). Unfortunately I cannot easily change the type of my texture that I'm binding to the image unit at runtime -- is it possible to use a different image format with imageLoad and still access the 24-bit RGB data?


Solution

  • No, you cannot use GL_RGB8 with image load/store. This is done because implementations are allowed to support GL_RGB8 by substituting it with GL_RGBA8. But they are also allowed to not do that if they can support 3-component formats directly. So OpenGL as a specification does not know if the implementation can actually handle 24-bits-per-pixel or if its pretending to do so with a 32-bit texture.

    So OpenGL just forces you to do the substitution explicitly.