GL_UNSIGNED_BYTE 对于 glTexImage2D 意味着什么?
我想加载一个包含 RGBA 8888 格式纹理的字节数组。
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。
在常规OpenGL上,有一个值 GL_UNSIGNED_INT_8_8_8_8 可以满足我的需求 - 并且数字的解释如下:
例如,如果internalFormat为GL_R3_G3_B2,则您要求纹素为3位红色、3位绿色和2位蓝色。
所以GL_UNSIGNED_INT_8_8_8_8必须是8位R、8位G、8位B和8位A。
但是GL_UNSIGNED_BYTE在ES平台上意味着什么,又会如何解释呢? (R、G、B、A 分别是多少位?)
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?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GL_UNSIGNED_BYTE 应与 GL_RGBA 格式一起使用,为每个组件提供 8 位。
GL_UNSIGNED_BYTE should work with format GL_RGBA, giving 8 bits per component.