Answer the question
In order to leave comments, you need to log in
How to draw a texture on a mesh in three js?
Hello! I recently started learning the three js library. Unable to stretch the texture on the mesh. Please tell me how to do it.
Answer the question
In order to leave comments, you need to log in
https://threejs.org/docs/#api/en/loaders/TextureLoader
// instantiate a loader
var loader = new THREE.TextureLoader();
// load a resource
loader.load(
// resource URL
'textures/land_ocean_ice_cloud_2048.jpg',
// onLoad callback
function ( texture ) {
// in this example we create the material when the texture is loaded
var material = new THREE.MeshBasicMaterial( {
map: texture
} );
},
// onProgress callback currently not supported
undefined,
// onError callback
function ( err ) {
console.error( 'An error happened.' );
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question