Hello!
I render into a RenderTexture and later I grab the texture from the RenderTexture to create a Sprite:
Texture2D* tex = myRenderTexture->getSprite()->getTexture();
Sprite* sprite = Sprite::createWithTexture(tex);
mScene->addChild(sprite, 7);
Whenever I draw again into the RenderTexture, my sprite is also affected! It seems like the Sprite stores the Texture Pointer that points to the texture of the RenderTexture. How can I create a Sprite that uses a clone of the RenderTexture’s texture and thus does NOT get affected when I render into the RenderTexture again?
In other words I want this:
- Render into RenderTexture
- Fetch texture from RenderTexture and create Sprite A from it
- Show Sprite A in scene
- Render again into RenderTexture wihout (!) modifying what Sprite A is showing
- Again grab texture from RenderTexture and update the texture of A (from now on Sprite shows updated texture)
and so on…
Thanks!