纹理切换时,为什么速度慢?
代码 - 1
glBindTexture(GL_TEXTURE_2D,texId01);
glDrawArray(glDrawArrays(GL_TRIANGLES, 0, 4);
glBindTexture(GL_TEXTURE_2D,texId02);
glDrawArray(glDrawArrays(GL_TRIANGLES, 0, 4);
代码 - 2
glBindTexture(GL_TEXTURE_2D,texId01);
glDrawArray(GL_TRIANGLES, 0, 4);
glDrawArray(GL_TRIANGLES, 0, 4);
为什么这些速度不同?
最佳答案
对于 PowerVR 硬件、设备和其他设备上的 OpenGLES,赞成的答案是错误的。我已经在几个场合遇到过这个“纹理绑定(bind)很慢”的神话,但是没有一个性能文档(Apple 或 Imagination Technologies)提到过这个。
所以我直接和 Imagination Technologies 核对了这个,他们的回答是:
Using glBindTexture shouldn't make any difference in performance besides what we've mentioned in our documentation, there is a small overhead but not a huge one. Some information out there seems to mention texture switching when using glTexture2D to reload textures which IS a slow call and should only be done when first initialising the app
关于c++ - 关于 OpenGLES 中的纹理切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3212442/