Skip to content

Add dispose listener to delete/destroy gpu textures. - #31

Open
castano wants to merge 3 commits into
mainfrom
external-texture-dispose
Open

Add dispose listener to delete/destroy gpu textures.#31
castano wants to merge 3 commits into
mainfrom
external-texture-dispose

Conversation

@castano

@castano castano commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

External textures do not automatically delete/destroy the internal GL texture object of GPUTexture. Register event listener to ensure resources are released.

@castano

castano commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator Author

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?

@donmccurdy

donmccurdy commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants