diff --git a/index.html b/index.html index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3a05f2dcd777d7cb653e7e86a9a95ba30b760d7b 100644 --- a/index.html +++ b/index.html @@ -0,0 +1,23 @@ +<!doctype html> +<html> + <head> + <meta charset="utf-8"> + <title>WebGL Tutorial</title> + <style> +html,body { + height: 100%; + margin: 0; + overflow: hidden; +} +canvas#view { + width: 100%; + height: 100%; + background: radial-gradient(gray, transparent); +} + </style> + </head> + <body> + <canvas id="view"></canvas> + <script src="script.js"></script> + </body> +</html> diff --git a/script.js b/script.js index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..85a21c88cb75d0e08d60d3b4e7add1f48f6009f2 100644 --- a/script.js +++ b/script.js @@ -0,0 +1,9 @@ +document.addEventListener('DOMContentLoaded', () => { + if ('undefined' === typeof WebGL2RenderingContext) { + throw new Error('This tutorial required WebGL version 2.'); + } + const glCtx = document.querySelector('canvas#view').getContext('webgl2'); + if (!glCtx) { + throw new Error('Failed WebGL Initialization.') + } +});