diff --git a/packages/core/src/renderers/systems/textures/TextureSystem.js b/packages/core/src/renderers/systems/textures/TextureSystem.js index 5e5a7d6..e4d108a 100644 --- a/packages/core/src/renderers/systems/textures/TextureSystem.js +++ b/packages/core/src/renderers/systems/textures/TextureSystem.js @@ -204,13 +204,15 @@ */ destroyTexture(texture, skipRemove) { + const gl = this.gl; + texture = texture.baseTexture || texture; if (texture._glTextures[this.renderer.CONTEXT_UID]) { this.unbind(texture); - texture._glTextures[this.renderer.CONTEXT_UID].texture.destroy(); + gl.destroyTexture(texture._glTextures[this.renderer.CONTEXT_UID].texture); texture.off('dispose', this.destroyTexture, this); delete texture._glTextures[this.renderer.CONTEXT_UID]; diff --git a/packages/core/src/renderers/systems/textures/TextureSystem.js b/packages/core/src/renderers/systems/textures/TextureSystem.js index 5e5a7d6..e4d108a 100644 --- a/packages/core/src/renderers/systems/textures/TextureSystem.js +++ b/packages/core/src/renderers/systems/textures/TextureSystem.js @@ -204,13 +204,15 @@ */ destroyTexture(texture, skipRemove) { + const gl = this.gl; + texture = texture.baseTexture || texture; if (texture._glTextures[this.renderer.CONTEXT_UID]) { this.unbind(texture); - texture._glTextures[this.renderer.CONTEXT_UID].texture.destroy(); + gl.destroyTexture(texture._glTextures[this.renderer.CONTEXT_UID].texture); texture.off('dispose', this.destroyTexture, this); delete texture._glTextures[this.renderer.CONTEXT_UID]; diff --git a/packages/core/test/ImageResource.js b/packages/core/test/ImageResource.js index e22c2a9..3118cc7 100644 --- a/packages/core/test/ImageResource.js +++ b/packages/core/test/ImageResource.js @@ -42,7 +42,7 @@ expect(resource.width).to.equal(0); expect(resource.height).to.equal(0); expect(resource.valid).to.be.false; - expect(resource.url).to.equal(`file://${this.slugUrl}`); + expect(resource.url).to.equal(image.src); resource.destroy(); }); diff --git a/packages/core/src/renderers/systems/textures/TextureSystem.js b/packages/core/src/renderers/systems/textures/TextureSystem.js index 5e5a7d6..e4d108a 100644 --- a/packages/core/src/renderers/systems/textures/TextureSystem.js +++ b/packages/core/src/renderers/systems/textures/TextureSystem.js @@ -204,13 +204,15 @@ */ destroyTexture(texture, skipRemove) { + const gl = this.gl; + texture = texture.baseTexture || texture; if (texture._glTextures[this.renderer.CONTEXT_UID]) { this.unbind(texture); - texture._glTextures[this.renderer.CONTEXT_UID].texture.destroy(); + gl.destroyTexture(texture._glTextures[this.renderer.CONTEXT_UID].texture); texture.off('dispose', this.destroyTexture, this); delete texture._glTextures[this.renderer.CONTEXT_UID]; diff --git a/packages/core/test/ImageResource.js b/packages/core/test/ImageResource.js index e22c2a9..3118cc7 100644 --- a/packages/core/test/ImageResource.js +++ b/packages/core/test/ImageResource.js @@ -42,7 +42,7 @@ expect(resource.width).to.equal(0); expect(resource.height).to.equal(0); expect(resource.valid).to.be.false; - expect(resource.url).to.equal(`file://${this.slugUrl}`); + expect(resource.url).to.equal(image.src); resource.destroy(); }); diff --git a/packages/spritesheet/test/SpritesheetLoader.js b/packages/spritesheet/test/SpritesheetLoader.js index 7238330..966c257 100644 --- a/packages/spritesheet/test/SpritesheetLoader.js +++ b/packages/spritesheet/test/SpritesheetLoader.js @@ -91,8 +91,8 @@ } next(); }) - .add(`atlas_crn`, `file://${__dirname}/resources/atlas_crn.json`) - .add(`atlas`, `file://${__dirname}/resources/building1.json`) + .add(`atlas_crn`, path.join(__dirname, 'resources', 'atlas_crn.json')) + .add(`atlas`, path.join(__dirname, 'resources', 'building1.json')) .load((loader, resources) => { expect(resources.atlas_image.data).to.be.instanceof(HTMLImageElement);