OpenGL ES 中单个纹理和纹理表之间的效率比较
人们普遍认为,使用充满许多较小纹理(例如字体表)的大纹理“图像”比单独使用每个纹理更快。性能提升有多大?它会明显更快还是会有微小的改进?
It's generally regarded that using a big texture 'image' full of many smaller textures (think font sheets) is faster than having each texture separate. How big is the improvement in performance? Would it be noticeably faster or will it be a minor improvement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您使用的纹理数量。如果你的纹理很少,那么使用单独的纹理就可以了。如果您正在制作一个包含大量纹理(真的很多)的大世界,那么图集纹理是一个合适的解决方案。
这都是因为OpenGL是一个状态机,状态机上的每一次改变都会付出代价。进行多次
glBindTexture()
调用的成本很高,因此只需将其与您拥有的纹理数量进行比较即可。It depends on how many textures you are using. If you have few textures, you can be fine with separate textures. If you are making a big world containing of lots of textures (really many), then atlas texture is a suitable solution.
It is all because OpenGL is a state machine, and every change on the state machine costs. Doing many
glBindTexture()
calls are costly, so just compare it with how many textures you have.