Answer the question
In order to leave comments, you need to log in
Why doesn't texture work in three.js: loader.addEventListener('load',function(event){?
var cub_texture,loader;
cub_texture= new THREE.Texture();
loader= new THREE.ImageLoader();
loader.addEventListener('load',function(event){
cub_texture.image=event.content;
cub_texture.needsUpdate=true;
});
loader.load('./img/textBox.jpg');
var cub_material = new THREE.MeshBasicMaterial({map:cub_texture,overdraw:true});
loader.load(''./img/textBox.jpg'',function(event){
cub_texture.image=event.content;
cub_texture.needsUpdate=true;
});
Answer the question
In order to leave comments, you need to log in
var cube_geometry = new THREE.CubeGeometry(100, 100, 100);
cube_two_texture = new THREE.TextureLoader().load( 'img.jpg' );//load texture
var cube_two_material = new THREE.MeshBasicMaterial({map: cube_two_texture});
var cube_two = new THREE.Mesh(cube_geometry, cube_two_material);
cube_two.position.y = -200;
scene.add(cube_two);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question