Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does GL_UNSIGNED_BYTE mean for glTexImage2D?

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?)

like image 436
bobobobo Avatar asked Nov 16 '10 04:11

bobobobo


1 Answers

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

like image 142
alxx Avatar answered Sep 20 '22 21:09

alxx