开发者

What does GL_UNSIGNED_BYTE mean for glTexImage2D?

开发者 https://www.devze.com 2023-01-25 20:40 出处:网络
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

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 interpr开发者_运维百科eted 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?)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消