问题
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 image object.
I've created the amount of textures needed with loadTexture, now every time i need to load a new image i just want to update my current textures with their data
Appreciate any help
回答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';
来源:https://stackoverflow.com/questions/23718005/how-to-update-texture-in-threejs-with-loaded-image-data