generate texture from array in threejs
I am trying to generate a texture from an array in threeJS and it is not working as expected. It appears that the way I generate the texture is not correct. If I use the following texture, it works as expected. http://www.html5canvastutorials.com/demos/assets/crate.jpg crateTex = THREE.ImageUtils.loadTexture('data/crate.jpg'); If I generate a dummy texture and try to display it, it is all black... var dummyRGBA = new Uint8Array(4 * 4 * 4); for(var i=0; i< 4 * 4; i++){ // RGB from 0 to 255 dummyRGBA[4*i] = dummyRGBA[4*i + 1] = dummyRGBA[4*i + 2] = 255*i/(4*4); // OPACITY dummyRGBA[4*i + 3] =