diff --git a/texture.cpp b/texture.cpp index 37e29bd..504d7a5 100755 --- a/texture.cpp +++ b/texture.cpp @@ -60,8 +60,8 @@ namespace vb01{ } } - void Texture::loadImageData(ImageAsset *asset, int i){ - glDeleteTextures(1, &texture[i]); + void Texture::loadImageData(ImageAsset *asset, bool creating, int i){ + if(!creating) glDeleteTextures(1, &texture[i]); width = asset->width; height = asset->height; @@ -81,7 +81,7 @@ namespace vb01{ if(paths[i].substr(length - 4, string::npos) == ".png") png = true; - loadImageData((ImageAsset*)AssetManager::getSingleton()->getAsset(paths[i])); + loadImageData((ImageAsset*)AssetManager::getSingleton()->getAsset(paths[i]), true); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); diff --git a/texture.h b/texture.h index 55f073d..d6f88e8 100755 --- a/texture.h +++ b/texture.h @@ -22,7 +22,7 @@ namespace vb01{ void select(int = 0, int = 0); void update(int = 0); void animate(float, KeyframeChannel); - void loadImageData(ImageAsset*, int = 0); + void loadImageData(ImageAsset*, bool, int = 0); inline u32* getTexture(int i = 0){return &(texture[i]);} inline std::string* getPath(){return paths;} inline int getNumFrames(){return numFrames;}