2

First time i am developing android app with cocos2d-2.0-x-2.0.4 on Samsung GT-N8000, so help me if anyone having idea on this topic .

Everything works fine with shaders on this device but I found error when the device goes to lock mode and unlocked.

4

1 回答 1

2

是的。我们遇到了同样的问题。一旦应用程序进入后台并从其恢复,无论添加到“shadercache”的自定义着色器都不起作用。只需尝试重置您的自定义着色器并在其位置添加一个新着色器。

有关更多信息CCShaderCache::reloadDefaultShaders(),请检查称为应用程序简历的内容。

  CCGLProgram * program = CCShaderCache::sharedShaderCache()->programForKey("customshader");
   //reset the old
    if(program)
        program->reset();

{
    CCGLProgram * p = new CCGLProgram();
    .....
    .....
    p->updateUniforms();
    //add new shader
    CCShaderCache::sharedShaderCache()->addProgram(p, "customshader");
    p->release();

}
于 2013-07-04T10:27:03.257 回答