Add dispose listener to delete/destroy gpu textures. - #31
Conversation
|
Hey @donmccurdy, do you know what is the right way to handle disposal of three.js ExternalTextures? This issue was brought up by a discussion in the 3DTilesRendererJS repository: NASA-AMMOS/3DTilesRendererJS#1497 (comment) Would you mind chiming in with your thoughts about this subject? I'm under the impression that the solution proposed here is correct, but may be surprising to three.js developers who expect automatic sharing of texture resources. The solution is probably to manage these resources in a similar fashion as suggested here: #32 Thoughts? |
|
Hm, good question! I think your proposal here is good "in general" for three.js use, it's nice that the ExternalTexture will be cleaned up automatically. THREE.GLTFLoader doesn't handle that quite so well for imagebitmap textures today. But for the 3D Tiles Renderer I see it may be more difficult, I've left a longer comment there. |
add typescript api.
External textures do not automatically delete/destroy the internal GL texture object of GPUTexture. Register event listener to ensure resources are released.