GL_UNSIGNED_BYTE 对于 glTexImage2D 意味着什么?

发布于 2024-10-02 19:57:17 字数 577 浏览 0 评论 0原文

我想加载一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉徒眸意 2024-10-09 19:57:17

GL_UNSIGNED_BYTE 应与 GL_RGBA 格式一起使用,为每个组件提供 8 位。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文