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 7082834 commit c10c4c9Copy full SHA for c10c4c9
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