Jump to content

How texture/baseTexture cache work in PIXI?


Wynell
 Share

Recommended Posts

Hello!

When I load a texture using app.loader.add() or PIXI.Texture.from(), it's saved in the Texture Cache so the next time the client won't make a request to get the image. This is all I know.

> So instead of saving a texture into a variable, is it a good idea to call PIXI.Texture.from() every time as it will take it from the cache further times anyway? Or check PIXI.utils.TextureCache? Or what else way is good?

 

> If I change the texture properties (width, defaultAnchor etc.), what will this affect other than exactly this instance of the texture obtained with PIXI.Texture.from()?
(For example, I loaded a texture, increased its width and what will be its width the next time I load it using PIXI.Texture.from()?)

 

> If I change the texture.baseTexture properties, what will this affect other than ex
> How baseTextures work in the Cache at all?

 

> What if I want to reload the image from the server when it's already saved in the cache?

Edited by Wynell
Link to comment
Share on other sites

PIXI.utils.TextureCache has no special logic. If it doesnt work for you - you have to search it through pixi source code and figure out. Because, honestly, every time I have problems with it - I do exactly that, its not possible to remember, its a business-logic-like thing.

Some people empty the cache every time and use their own storage. Its possible to use purely "PIXI.Loader" without any caching.

Even "caching" here means not GPU cache or something like that - no, its just a MAP that stores TEXTURE_NAME->TEXTURE pairs, same for basetexture. Entries are not immutable, you change one field - it will stay changed like that, you have to create another Texture with same BaseTexture and "frame" if you want to change something

Edited by ivan.popelyshev
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...