This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // showcased in https://engineering.crisalix.com/articles/hello-3d-world/ | |
| // canvas stuff | |
| const canvas = document.createElement('canvas') | |
| document.body.appendChild(canvas) | |
| // create a "renderer" (grab the WebGL context) | |
| const gl = canvas.getContext('webgl') | |
| gl.canvas.width = window.innerWidth | |
| gl.canvas.height = window.innerHeight | |
| let aspect = gl.canvas.clientWidth / gl.canvas.clientHeight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // showcased in https://engineering.crisalix.com/articles/hello-3d-world/ | |
| // using three.js r160 | |
| // scene stuff | |
| const renderer = new THREE.WebGLRenderer({ antialias: true }) // create a renderer | |
| renderer.setSize(window.innerWidth, window.innerHeight) | |
| document.body.appendChild(renderer.domElement) | |
| const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000) // create a camera | |
| camera.position.z = 2 // create a scene | |
| const scene = new THREE.Scene() |