Jörg Plewe Posted November 25, 2021 Share Posted November 25, 2021 Hi all! I have to deal with lots of non-changing text objects. My idea is to use Pixi.Text as a provider for a texture and create a Pixi.Sprite from it. Like so: const txt = new Text(text, style); txt.updateText(false); container.addChild(new Sprite(txt.texture)); This actually works but leaves me with dangling Pixi.Text objects, each allocating a canvas and such, eating up memory. So I added a destroy(): const txt = new Text(text, style); txt.updateText(false); container.addChild(new Sprite(txt.texture)); txt.destroy({texture: false}); which gives me a WebGL: INVALID_VALUE: texImage2D: no canvas Next, I tried to clone the texture before destroying the Pixi.Text: const txt = new Text(text, style); txt.updateText(false); const texture = txt.texture.clone(); container.addChild(new Sprite(txt.texture)); txt.destroy(); which gives me just empty images. So ... why doesn't the texture cloning work? Are there better ways to deal with that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.