Jump to content

Texture loader with progress callback


binyan
 Share

Recommended Posts

Hi,

I'm looking for a best way to load several textures while displaying the progress to the user.

Until now I've found the Tools.LoadImage method which works well and even cares for IndexedDB. However this method returns an Image object, and I didn't found a way to create a texture from an Image.

Texture constructor receives the Url of an image and not an Image object. In addition, this method (Tools.LoadImage) provides just OnLoad callback and I want the OnProgress.

I've also looked at FilesInput class, but it appears that this class is used for Drag&Drop files loading and I can't use it for my own purposes.

 

Any suggestions? I'm sure that I'm missing something, certainly there is a simple way to do it.

Link to comment
Share on other sites

Yes I can, but I'm looking for a more elegant solution than just polling texture.isReady... 

The best is something similar to Tools.LoadFile just for Texture.

If it's so problematic I'm ready to compromise on progress for individual texture, but still, how can I get at least an OnLoad callback for a texture?

Link to comment
Share on other sites

Hello !

I think the problem I had was similar and the solution of Deltakosh worked well for me :

 

Hello,

 

You can have a setTimeout function that periodically check texture.isReady?

 

 

Here is a link of the topic :

http://www.html5gamedevs.com/topic/6202-time-between-texture-load-and-rendering/

 

NB: The function I made on topic could be certainly refactored but the idea is there ^^.

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