<!DOCTYPE html> | |
<style> | |
canvas { | |
width: 200px; | |
height: 200px; | |
} | |
</style> | |
<canvas></canvas> | |
<script> | |
function paint() { | |
const canvas = document.querySelector("canvas"); | |
canvas.width = 200; | |
canvas.height = 200; | |
const gl = canvas.getContext("webgl"); | |
gl.clearColor(0, 1, 0, 1); | |
gl.clear(gl.COLOR_BUFFER_BIT); | |
} | |
window.addEventListener("load", paint, false); | |
</script> |