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?
Asked
Active
Viewed 959 times
2

AnimatedRNG
- 1,859
- 3
- 26
- 39
-
"*Unfortunately I cannot easily change the type of my texture that I'm binding to the image unit at runtime*" ... how not? It's *your texture*; you created it. How can you not be in control of its format? – Nicol Bolas Jun 24 '16 at 19:10
-
While I can change the format of the texture, I cannot actually change the pixel data at runtime. In other words, I get an byte array of a certain size that's internally structured with 3 consecutive 8-bit fields -- I can't create a new array that has 4 consecutive 8-bit fields so that I could use GL_RGBA8UI – AnimatedRNG Jun 24 '16 at 19:19
-
4... So? OpenGL can upload RGB data to an RGBA8 texture. And if you think that this will be slower, consider that OpenGL is probably *already doing that* with your current 3-channel texture. – Nicol Bolas Jun 24 '16 at 19:22
1 Answers
4
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.

Nicol Bolas
- 449,505
- 63
- 781
- 982