Graphics Reference
In-Depth Information
cubeMaterial.map.needsUpdate = true;
This informs Three.js that our canvas texture has changed and needs to be
updated the next time the scene is rendered.
With these four simple steps, you can easily create interactive textures and use
everything you can create on a canvas element as a texture in Three.js.
How it works...
How this works is actually pretty simple. Three.js uses WebGL to render scenes and
apply textures. WebGL has native support for using HTML canvas element as tex-
tures, so Three.js just passes on the provided canvas element to WebGL and it is
processed as any other texture.
See also
• Besides using images and canvas elements as textures, we can also use a
video element as a texture. In the Using HTML video as a texture recipe, we
show you how to use a HTML video element as the input for a texture.
Search WWH ::




Custom Search