Hi eveyone
I want add a texture on my cube
this is the message I get
this is the folder where I put the picture I want add
Hi eveyone
I want add a texture on my cube
this is the message I get
this is the folder where I put the picture I want add
//import imageSource from './Color.jpg';
let texture_loader=new THREE.TextureLoader();
let imageSource=texture_loader.load("./Color.jpg");
//import imageSource from './Color.jpg';
let texture_loader=new THREE.TextureLoader();
let imageSource_2=texture_loader.load("./Color.jpg");
try imageSource_2
This method work fine
const image=new Image()
const texture=new THREE.Texture(image)
image.onload=()=>{
texture.needsUpdate=true
}
image.src='images/color.jpg'
const material=new THREE.MeshBasicMaterial({map:texture})```
thanks to take time to answer me Chaser_Code
Its unregular case for texture loading for me.
wait is that windows 7? or just a theme?
let loader = new THREE.TextureLoader()
let texture = loader.load('images/color.jpg');
-or-
let texture = await loader.loadAsync('images/color.jpg')
(if you want to forcably wait for it to load..)
should work?
I would advise you to learn the basics of JavaScript first. When you declare variables using let, const or var, each such declaration must be followed by a semicolon, and if you declare multiple variables, a comma is used, but the keyword (let, var or const) is written only once before this list. That is,
let texture_loader=new THREE.TextureLoader();
let imageSource=texture_loader.load("./Color.jpg");
or
let texture_loader=new THREE.TextureLoader(),
imageSource=texture_loader.load("./Color.jpg");