Class for loading a texture. This uses the ImageLoader internally for loading files.

Code Example

const texture = new v3d.TextureLoader().load('textures/land_ocean_ice_cloud_2048.jpg'); // immediately use the texture for material creation const material = new v3d.MeshBasicMaterial({ map: texture });

Code Example with Callbacks

// instantiate a loader const loader = new v3d.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 const material = new v3d.MeshBasicMaterial({ map: texture }); }, // onProgress callback currently not supported undefined, // onError callback function(err) { console.error('An error happened.'); } );


TextureLoader(manager : LoadingManager)

manager — The loadingManager for the loader to use. Default is v3d.DefaultLoadingManager.

Creates a new TextureLoader.


See the base Loader class for common properties.


See the base Loader class for common methods.

.load(url : String, onLoad : Function, onProgress : Function, onError : Function) → Texture

url — the path or URL to the file. This can also be a Data URI.
onLoad (optional) — Will be called when load completes. The argument will be the loaded texture.
onProgress (optional) — This callback function is currently not supported.
onError (optional) — Will be called when load errors.

Begin loading from the given URL and pass the fully loaded texture to onLoad. The method also returns a new texture object which can directly be used for material creation. If you do it this way, the texture may pop up in your scene once the respective loading process is finished.


For more info on how to obtain the source code of this module see this page.