I've been experimenting with generating textures from arrays in threeJS but I'm encountering unexpected results.
It seems like the method I'm using to generate the texture is incorrect.
When I use the texture from the following link, everything works as intended:
crateTex = THREE.ImageUtils.loadTexture('data/crate.jpg');
However, when I attempt to display a dummy texture that I generated, it shows up completely black...
var dummyRGBA = new Uint8Array(4 * 4 * 4);
for(var i=0; i< 4 * 4; i++){
// RGB values range from 0 to 255
dummyRGBA[4*i] = dummyRGBA[4*i + 1] = dummyRGBA[4*i + 2] = 255*i/(4*4);
// OPACITY
dummyRGBA[4*i + 3] = 255;
}
dummyDataTex = new THREE.DataTexture( dummyRGBA, 4, 4, THREE.RGBAFormat );
dummyDataTex.needsUpdate = true;
dummyTex = new THREE.Texture(dummyDataTex);