问题
How to use THREE.ImageUtils.loadTexture() in jsfiddle. I have created a demo [ http://jsfiddle.net/georgeneil/cfrsj/10/ ]. Here I am not able to view the texture. I am getting the points rendered as black.
回答1:
You can base64 encode the image. And then add the string in your code.
Updated jsfiddle: http://jsfiddle.net/cfrsj/11/
回答2:
The problem is you cannot use a texture that is hosted externally. Here is some code I created to put a texture on a plane. I believe I adapted this code from one of mr doob's projects:
img = new Image();
texture = new THREE.Texture(img);
img.onload = function() {
texture.needsUpdate = true;
makeParticle();
};
img.src = "http://www.aerotwist.com/tutorials/creating-particles-with-three-js/images/particle.png";
geometry = new THREE.PlaneGeometry( 438, 695, 200 );
material = new THREE.MeshBasicMaterial( {map: texture} );
来源:https://stackoverflow.com/questions/11753720/how-to-load-texture-in-jsfiddle