Scale image texture

Hi,

We are working on a function that will be called when for example a slider changes values and it updates the scale of an image texture. The image texture has already been created with drawing the image source on a canvas. Now the question is when I scale the image texture with a slider, it means it will update a lot. The function is also gonna update more than just scale. Is it better/less heavy to do it with WebGL or by redrawing the canvas?

I’m not sure whether I understand the question correctly.

Scaling a texture could be done with its repeat property. This is very fast operation, because it just recalculates one 3x3 matrix.

However, if you use canvas texture, redrawing the image in the canvas and updating the texture (via its needsUpdate property) is also fast. Try this demo, it redraws the canvas each frame:

https://codepen.io/boytchev/full/NWmaWVL

Finally, you will have to update the texture only when the slider position is changed, so if there is some delay, it will happen only during the sliding … but most likely users will not notice it at all.