From 86585d6a01d211b47fa7f97e9dbfc84026ff45ab Mon Sep 17 00:00:00 2001 From: pandamicro Date: Sun, 8 Apr 2018 00:40:07 +0800 Subject: [PATCH] Explicitly destroy old gl texture before update --- cocos2d/core/assets/CCTexture2D.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cocos2d/core/assets/CCTexture2D.js b/cocos2d/core/assets/CCTexture2D.js index fb45d17a63..ab17030026 100644 --- a/cocos2d/core/assets/CCTexture2D.js +++ b/cocos2d/core/assets/CCTexture2D.js @@ -362,6 +362,9 @@ var Texture2D = cc.Class({ this._image = options.images[0]; } else if (options.image !== undefined) { + // Release previous gl texture if existed + this._texture.destroy(); + this._image = options.image; if (!options.images) { _images.length = 0;