- Due to the fact that map::insert doesn't allow to insert an element by existing key, I suggest to use operator []. It allows to change the

cached value, very helpful on Android platform: when context is lost, the application will reset - rebuild - recache all it's shaders.
This commit is contained in:
Timur Losev 2014-06-22 20:53:01 +03:00
parent b65991bf85
commit 196a924f89
1 changed files with 4 additions and 2 deletions

View File

@ -387,8 +387,10 @@ GLProgram* GLProgramCache::getGLProgram(const std::string &key)
void GLProgramCache::addGLProgram(GLProgram* program, const std::string &key)
{
if (program)
program->retain();
_programs.insert( std::make_pair( key, program) );
_programs[key] = program;
}
NS_CC_END