GL_UNSIGNED_BYTE对glTexImage2D意味着什么? [英] What does GL_UNSIGNED_BYTE mean for glTexImage2D?
问题描述
我想加载一个包含RGBA 8888格式纹理的字节数组.
I want to load a byte array containing a texture in RGBA 8888 format.
OpenGL ES文档提供了4个要使用的常量:GL_UNSIGNED_BYTE,GL_UNSIGNED_SHORT_5_6_5 ,GL_UNSIGNED_SHORT_4_4_4_4和GL_UNSIGNED_SHORT_5_5_5_1.
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.
在常规OpenGL 上,有一个值GL_UNSIGNED_INT_8_8_8_8可以满足我的需要-并由此对数字进行解释:
On regular OpenGL, there is a value GL_UNSIGNED_INT_8_8_8_8 that meets my needs -- and the numbers are interpreted thus:
例如,如果internalFormat为GL_R3_G3_B2,则您要求纹理像素为3位红色,3位绿色和2位蓝色.
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.
因此GL_UNSIGNED_INT_8_8_8_8必须为R的8位,G的8位,B的8位和A的8位.
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.
但是GL_UNSIGNED_BYTE在ES平台上是什么意思,它将如何解释? (R,G,B和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应该使用GL_RGBA格式,每个组件提供8位.
GL_UNSIGNED_BYTE should work with format GL_RGBA, giving 8 bits per component.
这篇关于GL_UNSIGNED_BYTE对glTexImage2D意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!