I am trying to set up my three.js according to tutorials I find on Youtube. I use Visual Studio Code and I copy the script exactly but for whatever reason when I check the live server it always shows me a blank white space when it's supposed to be black.
i've also noticed when I set up the scene, camera and renderer my THREE.Scene() and THREE.PerspectiveCamera() etc. are never the color green but instead blue. All the tutorials show them as green. I've done 5 tutorials so far and so far the exact same issue for all of them.
Here's an example of a tutorial I've used: https://www.youtube.com/watch?v=8jP4xpga6yY (Skip to 2:52 to see what I referring to in terms of the "green" script)
Am I missing something? Do i need to download an extension or something?
any input helps - thanks!
This is my main.js file
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000
);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
This is my index.html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Basic 3D World</title>
<style>
body {
margin: 0;
}
canvas {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/104/three.js"></script>
<script src="./mains.js"></script>
</body>
</html>
I copied code verbatim and instead of getting a black background that shows I'm ready to render my objects I get blank white space when accessing the Live Server. Also notice when I input THREE as I am typing instead of the script turning green it turns blue.
this is what all the tutorials show
this is what my code looks like - notice how thee THREE sections are blue instead of green