i noticed that when a TextureCanvas is created it is added two times to the scene. If i set a name to generated TextureCanvas it is possible see that there are two textures (“no name” and “textureCanvas”) in the section “Scene Explorer > Scene > Textures” of the inspector.
The problem is reproducible in the official playground adding the property name and activating the inspector:
Hi @SimoneDev, when something is drawn onto the TextureCanvas, it actually gets drawn on the back buffer (“no name”), which then gets copied to “textureCanvas”. It was made this way to have the texture shader use itself as a texture sampler for the background, because sampling and rendering itself at the same time doesn’t work.
This is the shader that draws something onto “no name”, where “backgroundSampler” is “textureCanvas”:
Hi @Gijs, thank you. My problem is that, when i dispose the TextureCanvas, the back buffer is not disposed. So i created a pull request in which i dispose the back buffer before to dispose the TextureCanvas; i also provide a property name for the TextureCanvas and his back buffer to easily identify them in the inspector.
Thanks for the help @SimoneDev, it looks like the best solution, so I’ve accepted it! It’s too bad we can’t use a setter for the name though for changing the name later on, to also change the backbuffer name.