Decoupling a render target texture from its render target

So essentially it seems to be impossible to clean up the render target without also destroying the texture. I generate textures for meshes using render targets during certain times, sometimes I need the depth texture, sometimes the color texture, but the only solution now seems to be to just let the render target leak, since calling dispose always wants to free up the associated textures as well.

The textures actual represent the attachments of a render target (or framebuffer). It’s not possible to decouple both since you can’t do this plain WebGL, too.

1 Like

Ah, that makes sense. I was looking for a way to copy the texture, but can’t seem to find a way for it. I presume I could use readRenderTargetPixels to get the color, but can’t seem to get the depth. That’s a bit inefficient from the get go though. Calling clone() on at least the depth texture also doesn’t seem to work.