Cocos2d 2.0: meaning and use of CC_ENABLE_GL_STATE_CACHE

I was wondering when should I enable CC_ENABLE_GL_STATE_CACHE and what are the limitations when using this. I found several messages that indicate potential problems on certain devices with certain OpenGL operations

EDIT: This is what I read from the configuration file. The main reason this is disabled is to use the previous code using the OpenGL 1.x ES features, hence starting this project from scratch using OpenGL 2.0 ES. I have to be fine.

/** @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 */ 
+4
source share
1 answer

It should be enabled by default.

The only reason I know this is not the default is what you said: backward compatibility. But since you shouldn't use the GL ES 1.1 features in cocos2d 2.0, it probably only caters for those upgrading from cocos2d 1.x to 2.x and gradually porting their GL ES 1.1 code to 2.0 - although you will have to change most if not all GL user code anyway.

I have had a status cache included in KoboldTouch since October 2012 (before the release of KT), and this did not cause me a single problem, and no one who works with KT reported a problem with state caching.

+2
source

All Articles