alteredq/three.js — comment on commit 01bebe5c40cb5177f0c7c02b13c4581d24001f05
File:  line 0
By michaud:

The example above is too complicated for me, is this the right direction? My code doesn't get error messages but also no result at all....

var rwidth = 200, rheight = 200, rsize = rwidth * rheight;

var tcolor = new THREE.Color( 0xffffff );

var dataColor = new Array( rsize * 3 );

for ( var i = 0; i < rsize; i++ )
{
var h = i / 255;

tcolor.setHSV( 0.55, 1 - h * h, h * h );

dataColor[i * 3] = 128;
dataColor[i * 3 + 1] = 128;
dataColor[i * 3 + 2] = 128;

}

var newArray = new Uint8Array( rsize * 3 );
newArray.set( dataColor );

var imageTexture = new THREE.DataTexture( newArray, rwidth, rheight, THREE.RGBFormat, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping );
imageTexture.needsUpdate = true;

var newPlane = new THREE.Mesh( new THREE.PlaneGeometry( 200, 200 ), imageTexture/*new THREE.MeshBasicMaterial( { color: 0xaaaaaa} )*/ );
newPlane.doubleSided = true;
newPlane.overdraw = true;
newPlane.position.z = -( i * 10 );
useScene.add( newPlane );