Jump to content

Loader and TextureCache - tutorial anywhere?


OnGe
 Share

Recommended Posts

Here is the loader:

 

https://github.com/englercj/resource-loader

 

The code is really well documented, and there are examples on the readme. The pixi examples also use the loader a few times:

 

http://pixijs.github.io/examples/

 

The TextureCache is an internal mechanism, there is rarely any reason you should even know it exists.

Link to comment
Share on other sites

Thanks, but Im not looking for API docs or simple use cases, what I need is some wider context. Like what is for what and why, how it works and so on - stuff that may seem obvious, if you already know it, but is not quite obvious if you dont.

 

TextureCache is good example - first I think it may help me with performance. Now it looks like its transparent and I can hardly make some more with it.

Link to comment
Share on other sites

Thanks, but Im not looking for API docs or simple use cases, what I need is some wider context. Like what is for what and why, how it works and so on - stuff that may seem obvious, if you already know it, but is not quite obvious if you dont.

 

TextureCache is good example - first I think it may help me with performance. Now it looks like its transparent and I can hardly make some more with it.

 

I'm honestly not sure what you are looking for, there aren't really "complex" usages of the loader. You add resources to it, and then you load them, and then you use them. Thats really all there is to it. What are you trying to do that you are having trouble with?

 

As for texture cache, it is a place where textures are placed internally when you use convience methods (.fromImage()) and loader methods, so that next time you do a convience method (.fromImage()) it pulls from cache and doesn't make a request. Thats all its for as well.

 

I'm not sure what to say, because I'm not sure what you want. Aside from writing custom middleware, I don't know what else there is to show off besides what is in the examples.

Link to comment
Share on other sites

What Im trying to get here is some deeper understanding of how this stuff works, because (besides that deeper understanding is always good thing) I had some problems with my experiments (involving relatively big images, color matrix and other funny things) like crushing mobile browsers, cropping parts of images that are out of screen initialy and many other wtf things that I atribute to some internal optimization. But Im not sure if it is on pixi, browser, WebGL or whatever else. And maybe Im totally wrong at all. And to figure it out, I seek some deeper insight.

 

Anyway, I was looking at TextureCache because I got idea to somehow turn scene made of many sprites into one static cached image to save resources. And maybe save that composed image to localStorage and load it instead of parts next time. Meanwhile I have found that this may make things even worse. And, as you say, TextureCache is something completely different than what I want.

 

If it is really that simple, then Im looking to wrong things...and also there is not much deeper understanding to get on this :)

 

Thanks for clarifying.

Link to comment
Share on other sites

Yeah the loader just sends a network request, parses the result, and then gives it to you. That's all. The code is super simple, and very well documented. If you want a deep understanding of how anything works, the best way to do it is to read the code. Pixi and the modules it uses are all open source. Just crack them open and start reading. Feel free to ask any questions you have here.

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...