I wrote a code to create a rectangular pyramid. There are no errors in console, but no output is shown.
Here is my code:
<script src=https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.js></script>
<script src="DragControls.js"></script>
<script src="TrackballControls.js"></script>
<script>
var camera,scene,renderer;
function init() {
// SCENE
scene = new THREE.Scene();
// CAMERA
camera = new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,0.1,1000);
//creating renderer, setting its size and appending it
renderer=new THREE.WebGLRenderer({antialias:true});
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var material = new THREE.MeshStandardMaterial( { color : 0x00cc00 } );
//Creating Pyramid
var geometry = new THREE.Geometry();
//Creating Vectors
geometry.vertices.push(
new THREE.Vector3(3,3,3),
new THREE.Vector3(8,5,2),
new THREE.Vector3(8,1,2),
new THREE.Vector3(8,1,4),
new THREE.Vector3(8,5,4)
);
geometry.faces.push(
new THREE.Face3(0,1,2),
new THREE.Face3(0,2,3),
new THREE.Face3(0,3,4),
new THREE.Face3(0,1,4),
new THREE.Face3(1,2,3,4)
);
geometry.computeFaceNormals();
geometry.computeVertexNormals();
scene.add( new THREE.Mesh( geometry, material ) );
}
var render = function () {
requestAnimationFrame(render);
renderer.render(scene, camera);
};
init();
render();
</script>
</body>
</html>