Skip to content Skip to sidebar Skip to footer

How To Update Texture In ThreeJS With Loaded Image Data?

I'm looking for the best way to update a texture in threejs with data loaded from an image ? loadTextture will create a new texture every time and i can't find a way to pass on an

Solution 1:

This code should be of some help?

var image = document.createElement( 'img' );
var texture = new THREE.Texture( image );

image.onload = function () {

    texture.needsUpdate = true;

};

image.src = 'image.png';

Post a Comment for "How To Update Texture In ThreeJS With Loaded Image Data?"