Created
November 20, 2017 08:57
-
-
Save emilio-martinez/d293ad7e6794cd2c954ee3c414e90173 to your computer and use it in GitHub Desktop.
Base64 Image Data as Texture in ThreeJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an image | |
const image = new Image(); // or document.createElement('img' ); | |
// Create texture | |
var texture = new THREE.Texture(image); | |
// On image load, update texture | |
image.onload = () => { texture.needsUpdate = true }; | |
// Set image source | |
image.src = 'data:image/png;base64,XXXXX'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment