I'm having trouble creating a quad with four vertices in three.js. Here's the code I've written, but it doesn't seem to be working:
var pointA = { x:10,
y:10}
var pointB = {x:50,
y:50}
var geometry = new THREE.Geometry();
geometry.vertices.push( new THREE.Vector3( pointA.x, pointA.y, 2 ) );
geometry.vertices.push( new THREE.Vector3( pointB.x, pointB.y, 2 ) );
geometry.vertices.push( new THREE.Vector3( pointB.x, pointB.y - 60, 2 ) );
geometry.vertices.push( new THREE.Vector3( pointA.x, pointA.y, 2 ) );
geometry.faces.push( new THREE.Face3(0,1,2) );
geometry.computeFaceNormals();
var material = new THREE.MeshBasicMaterial({ color: "0xff1100"});
var mesh = new THREE.Mesh( geometry, material );
scene.add(mesh);
Where am I going wrong with this code? Also, can I use Face4 instead of Face3 to render quads? Is there a comprehensive resource available for learning all webgl features at once? I find Three.js documentation to be quite organized and detailed.