Skip to content

Commit

Permalink
Dispose of previous texture
Browse files Browse the repository at this point in the history
  • Loading branch information
vasturiano committed Feb 16, 2022
1 parent 5f896f7 commit 3d81e32
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -178,6 +178,7 @@ export default class extends three.Sprite {
});

// Inject canvas into sprite
if (this.material.map) this.material.map.dispose(); // gc previous texture
const texture = this.material.map = new three.Texture(canvas);
texture.minFilter = three.LinearFilter;
texture.needsUpdate = true;
Expand Down

0 comments on commit 3d81e32

Please sign in to comment.