Jump to content

updateCache in Pixi v3


lindell
 Share

Recommended Posts

I have a static Container object that I set to cacheAsBitmap = true.

Even if it is static. Changes sometimes occur and wich means I want to redraw(/reCache) it at the next render.

I accidentally viewed the documentation for Pixi 2 and saw updateCache which seems to be what I want but I can't find it or anything similar in the documentation for V3.

How do I do this?

Link to comment
Share on other sites

Can always just set "cacheAsBitmap" to false, then back to true.

But I do only want to do this one time, at the next redraw. Then I need to know when the stage is redrawn and set it back. I could do this but it feels like there is an easier way

Link to comment
Share on other sites

I'm not sure what you mean, what I am saying is do this:

 

function updateCachedBitmap(obj) {    obj.cacheAsBitmap = false; // disable and cleanup currently cached bitmap    obj.cacheAsBitmap = true; // enable and recreate cached bitmap}
If you find you will be wanting to update something, it will probably be easier to just do it with a render texture and have full control:

var texture = new PIXI.RenderTexture(renderer),    sprite = new PIXI.Sprite(texture);texture.render(container); //whatever container you are currently cacheAsBitmap-ing// whenever you need to update the cached texture just do it:texture.render(container);
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...