gpt4 book ai didi

ios - Cocos2d 2.0 : meaning and usage of CC_ENABLE_GL_STATE_CACHE

转载 作者:可可西里 更新时间:2023-11-01 05:56:07 26 4
gpt4 key购买 nike

我想知道我什么时候should启用 CC_ENABLE_GL_STATE_CACHE 以及使用它的限制是什么。我找到了一些 posts表示某些设备上具有某些 OpenGL 操作的潜在问题

编辑:这是我从配置文件中读取的内容。保持此禁用状态的主要原因是如果我使用以前的代码使用 OpenGL 1.x ES 函数,因此,使用 OpenGL 2.0 ES 从头开始​​这个项目我应该没问题。

/** @def CC_ENABLE_GL_STATE_CACHE
If enabled, cocos2d will maintain an OpenGL state cache internally to avoid unnecessary switches.
In order to use them, you have to use the following functions, insead of the the GL ones:
- ccGLUseProgram() instead of glUseProgram()
- ccGLDeleteProgram() instead of glDeleteProgram()
- ccGLBlendFunc() instead of glBlendFunc()

If this functionality is disabled, then ccGLUseProgram(), ccGLDeleteProgram(), ccGLBlendFunc() will call the GL ones, without using the cache.

It is recommened to enable it whenever possible to improve speed.
If you are migrating your code from GL ES 1.1, then keep it disabled. Once all your code works as expected, turn it on.

Default value: Disabled by default

@since v2.0.0
*/

最佳答案

它应该默认启用。

我知道默认情况下它没有打开的唯一原因是你所说的:向后兼容性。但是因为你不应该在 cocos2d 2.0 中使用 GL ES 1.1 函数,所以这可能只服务于那些从 cocos2d 1.x 升级到 2.x 并逐渐将他们的 GL ES 1.1 代码迁移到 2.0 的人——尽管你必须改变大部分,即使在这种情况下不是所有自定义 GL 代码。

我在 KoboldTouch 中启用了状态缓存自 2012 年 10 月(KT 发布之前)以来,它没有给我带来任何问题,使用 KT 的任何人也没有报告与状态缓存相关的问题。

关于ios - Cocos2d 2.0 : meaning and usage of CC_ENABLE_GL_STATE_CACHE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15768687/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com