We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ImageBitmap.close()
webgl_loader_imagebitmap
1 parent 0c69d14 commit 688fdafCopy full SHA for 688fdaf
examples/webgl_loader_imagebitmap.html
@@ -38,10 +38,9 @@
38
texture.colorSpace = THREE.SRGBColorSpace;
39
const material = new THREE.MeshBasicMaterial( { map: texture } );
40
41
- /* ImageBitmap should be disposed when done with it
42
- Can't be done until it's actually uploaded to WebGLTexture */
+ // ImageBitmap should be disposed when done with it.
43
44
- // imageBitmap.close();
+ texture.onUpdate = disposeImageBitmap;
45
46
addCube( material );
47
@@ -148,6 +147,13 @@
148
147
149
}
150
+ function disposeImageBitmap( texture ) {
151
+
152
+ texture.source.data.close();
153
+ texture.onUpdate = null; // make sure this callback is executed only once per texture
154
155
+ }
156
157
</script>
158
159
</body>
0 commit comments