Skip to content
Snippets Groups Projects
Commit 8ad7e539 authored by Min-Jae, Lee's avatar Min-Jae, Lee
Browse files

Initializing WebGL2

parent 868a3514
No related branches found
No related tags found
No related merge requests found
<!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>
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.')
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment