I'm a beginner in ThreeJS. I want to import a cube basic from Blender in gLTF format... This is my code.
What is it missing?
var canvas = document.getElementById('canvas');
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
var scene = new THREE.Scene();
var renderer = new THREE.WebGLRenderer();
renderer.setClearColor(rosa, 1);
renderer.setSize(window.innerWidth, window.innerHeight);
var controls = new THREE.OrbitControls(camera, renderer.domElement);
canvas.appendChild(renderer.domElement);
// Instantiate a loader
var loader = new THREE.GLTFLoader();
function renderingScene() {
renderer.render(scene, camera);
}
function cargarGLTF() {
// Load a glTF resource
loader.load('./glTF/resources/cube/untitled.gltf', function (gltf) {
scene.add(gltf.scene);
});
// renderingScene();
}
cargarGLTF();
controlMouse();
renderingScene();
Output console