When I try to provide RGB(A) data for a texture, I am running up against some bizarre problems. For instance, recently I did an experiment where one texture was 100% red, the next 100% green and a third 100% blue, assuming the usual B-G-R-A byte order. These appeared on screen as blue, red, and brown.
The triangles that are using my texture don’t currently have a color but when I do set it, it seems to help. That is odd because I thought that for instance a 24-bpp texture is opaque.
Can anyone point me to a definitive source that is not another terrible tutorial that leaves out 90% of what I need to know, which explains that exact, precise, unequivocal byte order for RGBA data?
For instance: byte 0: blue 0…255
byte 1: green 0…255
byte 2: red 0…255
byte 3: alpha 0=transparent
There are so many GL_RGB* variants that it’s confusing.
For 24-bit data I’m trying this:
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, _pixels);
For 32-bit data I’m trying this:
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, _textureWidth, _textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, _pixels);
My data are byte-based and unsigned, so 0…255 for each of red, green and blue.
Thanks for any help.