1.2.1_preparing_to_render_in_3D - MartijnKeesmaat/WebGL-practice GitHub Wiki
Steps
- Get the reference of the DOM node and set the context
const canvas = document.querySelector('#glCanvas');
// Init GL context
const gl = canvas.getContext('webgl');
- Check if the context is initialized correctly
if (gl === null) {
alert('WebGl isn\'t working');
return;
}