I got another problem, I create Texture from an IMG URL but now i want to know how I can get the width and the heigth from that picture. I found an function which is called getSize, this fuction will give me sometimes an width and heigth but not for every Texture. Can someone tell me where the problem is?
here is thecode:
use this code to give the size to you texture
(var name of the texture).diffuseTexture.uScale = 1;
(var name of the texture).diffuseTexture.vScale = 1;
Mhhh that is not waht i looking for,I thougth that the texture got the same size like the IMG, because i want to know the Img size. I need to change the object size to not getting an distorted Img
you can look that at the inspectot panel in textures and know the size of the texture
yeah but i need to get the width and hight via code. Then i dont need to change the obj size manuel ( i got more than 1 obj to change). I tried mat1.width bevor and i only get undefined an an value.
You can only get the size after the texture is load, try to add a callback to texture’s onloadobservable to get the size.