30 lines
529 B
HTML
30 lines
529 B
HTML
<style>
|
|
canvas {
|
|
width: 10px;
|
|
height: 10px;
|
|
}
|
|
</style>
|
|
<script>
|
|
function runTest() {
|
|
// Step 1. Grab the WebGL canvas and render a solid color.
|
|
|
|
const canvas = document.querySelector("canvas");
|
|
canvas.width = 10;
|
|
canvas.height = 10;
|
|
|
|
const gl = canvas.getContext("webgl");
|
|
|
|
// Clear to green
|
|
|
|
gl.clearColor(0, 1, 0, 1);
|
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
}
|
|
|
|
window.addEventListener("load", runTest, false);
|
|
</script>
|
|
<div id="container1">
|
|
</div>
|
|
<div id="container2">
|
|
<canvas></canvas>
|
|
</div>
|