7

I want to load a byte array containing a texture in RGBA 8888 format.

The OpenGL ES docs offer 4 constants to use: GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_4_4_4_4, and GL_UNSIGNED_SHORT_5_5_5_1.

On regular OpenGL, there is a value GL_UNSIGNED_INT_8_8_8_8 that meets my needs -- and the numbers are interpreted thus:

For example, if internalFormat is GL_R3_G3_B2, you are asking that texels be 3 bits of red, 3 bits of green, and 2 bits of blue.

So GL_UNSIGNED_INT_8_8_8_8 must be 8 bits of R, 8 bits of G and 8 bits of B and 8 bits of A.

But what does GL_UNSIGNED_BYTE mean on the ES platform and how will it be interpretted? (How many bits are R, G, B and A?)

bobobobo
  • 64,917
  • 62
  • 258
  • 363

1 Answers1

8

GL_UNSIGNED_BYTE should work with format GL_RGBA, giving 8 bits per component.

alxx
  • 9,897
  • 4
  • 26
  • 41