How to get the size of datatexture


#1

Greetings everyone,

I am using a data texture to capture my screen.

I tried to get the size of the data texture like this but it’s returning [0,0].

console.log(myDataTexture1.size());

How can i get the exact value of the width and height of data texture.

Thanks in advance


#2

Hi, I was doing something similar and I discovered that the texture load is non-blocking, so it says [0,0] because probably it is still loading the image when you ask the size. If you delay the .size() call in any way it will return you a non-zero size. For me is not useful anyway, it returns the SQUARED size after Studio optimizes the texture, not the original one.