欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

android opengl es 纹理 不同设备 白色,android – OpenGL ES 2.0纹理没有在某些设备上显示...

发布时间:2025/4/16 编程问答 55 豆豆
生活随笔 收集整理的这篇文章主要介绍了 android opengl es 纹理 不同设备 白色,android – OpenGL ES 2.0纹理没有在某些设备上显示... 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

早上好,这是2个纹理非幂的典型例子.

由于多种原因,纹理在分辨率上需要2的幂,这是一个非常常见的错误,每个人都碰巧陷入这个陷阱:)我也是.

2个纹理的非功率在某些设备/ GPU上运行平稳的事实,仅仅取决于OpenGL驱动程序实现,一些GPU清楚地支持它们,其他一些不支持,我强烈建议你选择pow2纹理以便能够保证所有设备的功能.

最后但并非最不重要的是,使用2个纹理的非强大功能可能会让你在GPU内存利用率方面陷入困境,因为大多数接受非powerof2纹理的驱动程序需要在内存中将纹理重新缩放到最接近2因子的更高功率.例如,具有520X520的纹理可能导致1024X1024的实际存储器映射.

这是你不想要的东西,因为在现实世界中“大小很重要”,特别是在移动设备上.

你可以在OpenGL Gold Book中找到一个很好的解释,OpenGL ES 2.0:

In OpenGL ES 2.0, textures can have non-power-of-two (npot)

dimensions. In other words, the width and height do not need to be a

power of two. However, OpenGL ES 2.0 does have a restriction on the

wrap modes that can be used if the texture dimensions are not power of

two. That is, for npot textures, the wrap mode can only be

GL_CLAMP_TO_EDGE and the minifica- tion filter can only be GL_NEAREST

or GL_LINEAR (in other words, not mip- mapped). The extension

GL_OES_texture_npot relaxes these restrictions and allows wrap modes

of GL_REPEAT and GL_MIRRORED_REPEAT and also allows npot textures to

be mipmapped with the full set of minification filters.

我建议你评估这本书,因为它对这个主题做了相当不错的报道.

总结

以上是生活随笔为你收集整理的android opengl es 纹理 不同设备 白色,android – OpenGL ES 2.0纹理没有在某些设备上显示...的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。