Jump to content

Get Texture size


Temechon
 Share

Recommended Posts

Hi, 

 

I want to get the texture size I'm loading with the AssetsManager : http://www.babylonjs-playground.com/#28QGCJ#2

 

In the onSuccess function, this does not work : 

console.log(task.texture.getBaseSize());

But this works : 

setTimeout(function() {			     console.log(task.texture.getBaseSize());}, 1);

Can you tell me why ?

 

Thanks !

Link to comment
Share on other sites

@fenomas Thank you.

 

@DK, would it be possible to get these lines : 

texture._baseWidth = width;texture._baseHeight = height;texture._width = potWidth;texture._height = potHeight;texture.isReady = true;

Before the processFunction in prepareWebGLTexture ?

It solves my problem. 

If yes, I can submit a PR for this.

 

Thanks.

Link to comment
Share on other sites

Nice find/fix, Temechon!

 

This kind of bug is called a "wife bug".  I don't have a wife, but... I know how it works.

 

When a wife is scheduled to go somewhere with her husband... the husband will poll "Are you ready?"

 

Wife:  "Yes, I'm ready, I just need to do a couple more little things."

 

So, the return from the isReady() call... ==> .75  BOOLEAN!  (3/4 true)

 

This continues for many more isReady() pollings, and eventually the caller forces wife.isReady = true; and then the program counter moves-on, isReady or not.  :)  But watch out for try/catch causing a raise(hell) error.

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