binyan Posted May 22, 2014 Share Posted May 22, 2014 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 22, 2014 Share Posted May 22, 2014 Hello, You can have a setTimeout function that periodically check texture.isReady? Quote Link to comment Share on other sites More sharing options...
binyan Posted May 22, 2014 Author Share Posted May 22, 2014 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? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 22, 2014 Share Posted May 22, 2014 the Onload is called once the texture is loaded so you won't have a progress indicator this way Quote Link to comment Share on other sites More sharing options...
binyan Posted May 23, 2014 Author Share Posted May 23, 2014 Yes, I see, but for now I didn't found any way to load a texture even with OnLoad callback. The only thing that I have is image loading, but it doesn't give me a BABYLON.Texture. Quote Link to comment Share on other sites More sharing options...
celian-garcia Posted May 26, 2014 Share Posted May 26, 2014 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 ^^. 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.