I wonder what would make the difference if I create a scene, dispose it or not dispose it, and continue to render.
I did this experiment and it seems to be no different, after the buffer data is released and the render will continue to create the new buffer
I find the answer in document.
If the scene needs to remain active, this operation is not required, and it take a negative performance
What happens when I call dispose()
and then use the respective object at a later point?
The deleted internal resources will be created again by the engine. So no runtime error will occur but you might notice a negative performance impact for the current frame, especially when shader programs have to be compiled.
tl;dr version: any resource (scene / texture / geometru) that’s disposed from the GPU - will be re-created on the next attempt to render it.
That’s also why it’s important to first do .removeFromParent
on a mesh - only after that dispose the materials and textures assigned to that mesh. Otherwise you’ll be creating a memory leak on the GPU.
Thanks for reminding that. I’ve never noticed this before
Actually, the .removeFromParent
and the .dispose
just need to be on the same side of the renderer.render.