V!nc3r Posted October 18, 2018 Share Posted October 18, 2018 Something where I'm not (yet? ?) comfortable in programming logic is these callbacks things. So I see in the texture constructor that the onLoad function sent us a callback... how can I use this thing to manipulate the texture object just after its creation? I've started a playground here: http://www.babylonjs-playground.com/#K8AGLY > how can I access to the texture to sets its name, for example, or even better, to apply it on the material only when the onload is called? Thanks! Quote Link to comment Share on other sites More sharing options...
Exa Posted October 18, 2018 Share Posted October 18, 2018 Is this help you? onLoadObservable : https://doc.babylonjs.com/api/classes/babylon.texture#onloadobservable https://doc.babylonjs.com/playground/?code=onLoadObservable example : http://www.babylonjs-playground.com/#CNBXAI#1 V!nc3r 1 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted October 18, 2018 Author Share Posted October 18, 2018 as simple as that! thanks Exa 1 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted October 18, 2018 Author Share Posted October 18, 2018 Actually... I still have an issue, and I'm not sure if it comes from this onLoad or not: when I applied the texture once its loaded on a material, as you show me, I get a kind of "pop": https://imgur.com/6CxkiVb https://www.babylonjs-playground.com/#4AJ16M#10 (I choose a huge 2.5 MB texture) How this can be avoid? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 18, 2018 Share Posted October 18, 2018 Can you elaborate on the pop? I'm not sure to what I should look at (A video perhaps?) Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted October 19, 2018 Author Share Posted October 19, 2018 By trying to show you this "pop"... I saw that it was just the "Run" effect of the playground (so simply the reload of the scene) ? Everything is fine when we assign on the fly the texture, so... solved! https://www.babylonjs-playground.com/#4AJ16M#12 Quote Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2018 Share Posted October 19, 2018 LOL! V!nc3r 1 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.