CCShaderCache background

CCShaderCache background
0.0 0


Hi all,

I’m having some problem with custom shaders when going back from background in android

I’ve created a custom shader and I added it to the shader cache with a name, it works fine, i’m using it to modify some colors in CCLabelBMFont. When i go back to background the shaders appears to be wrong, it is drawn like it is a default shader, but i checked labels in scene got the right shader.

To fix that problem i put a call in method
void AppDelegate::applicationWillEnterForeground()

In that method I tried to make a reset to my shader and build it again but it appears that objects in the scene when i make a reset are drawn bad, and when i create the shader again they are not updated.

Do you know what i’m doing wrong?


I’ve been able to reload the shader making a call to my method after CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
in the main.cpp of android project, but it appears not to be working always, if i go back to background and foreground more than once it starts crashing .

I get a error like this:
OpenGL error 0x0502 in cocos2dx/sprite_nodes/CCSprite.cpp draw 584

OpenGL error 0x0501 in cocos2dx/textures/CCTextureAtlas.cpp drawNumberOfQuads 686

I’m using cocos2.2.1