I am attempting to create an RGB cube using Three.js without textures, only vertices. I have followed various tutorials but my code is not working as expected. Can anyone provide some advice? Thank you.
https://jsfiddle.net/yjru14q3/
var geom = new THREE.Geometry();
geom.vertices = vertices;
geom.vertexColors = colors;
var colors = [];
colors[0] = new THREE.Color( 0, 0, 0 );
....
var vertices = [];
vertices[0] = new THREE.Vector3( 0, 0, 0 );
....
var material = new THREE.MeshBasicMaterial({
vertexColors: THREE.VertexColors,
side: THREE.DoubleSide, // in case we go inside the cube
});
var cube = new THREE.Mesh(geom, material);
scene.add(cube);