mirror of https://github.com/axmolengine/axmol.git
- 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:
parent
b65991bf85
commit
196a924f89
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue