static void retain(GLuint id){ if(id!=0){ if(getTexturesIndex().find(id)!=getTexturesIndex().end()){ getTexturesIndex()[id]++; }else{ getTexturesIndex()[id]=1; } } }
static void release(GLuint id){ // try to free up the texture memory so we don't reallocate // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html if (id != 0){ if(getTexturesIndex().find(id)!=getTexturesIndex().end()){ getTexturesIndex()[id]--; if(getTexturesIndex()[id]==0){ glDeleteTextures(1, (GLuint *)&id); getTexturesIndex().erase(id); } }else{ ofLogError("ofTexture") << "release(): something's wrong here, releasing unknown texture id " << id; glDeleteTextures(1, (GLuint *)&id); } } }
static void release(GLuint id){ // try to free up the texture memory so we don't reallocate // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html if (id != 0){ if(getTexturesIndex().find(id)!=getTexturesIndex().end()){ getTexturesIndex()[id]--; if(getTexturesIndex()[id]==0){ glDeleteTextures(1, (GLuint *)&id); getTexturesIndex().erase(id); } }else{ ofLog(OF_LOG_ERROR, "trying to delete a non indexed texture, something weird is happening. Deleting anyway"); glDeleteTextures(1, (GLuint *)&id); } } }