c++ - 关于 OpenGLES 中的纹理切换

标签 c++ iphone c opengl-es

纹理切换时,为什么速度慢?


代码 - 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/

相关文章:

iphone - MediaPlayer.framework : How to "translate" MPMusicRepeatModeDefault into an actual mode?

iphone - 我需要在 ARC 中使用 dealloc 方法吗?

c - typedef 结构定义末尾的变量声明

c++ - 自定义静态分配器可能吗?/一种伪造它的方法?

iphone - 升级到 Xcode 4.2/iOS 5 后类别中的方法抛出异常

c++ - Pthread查询: Sequence of threads error

无法使用 mmap/malloc/open 等在 64 位 linux 系统上创建大于 2GB 的文件

c - 字符串数组访问错误

c++ - 如何在 C++ 中链接 .a 文件

c++ - 在透视图中旋转图像