blob: 1b4029fbee71a49f2d55554cd82f281a3c5eb233 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="screen">
body {
outline: 10px solid transparent; /* affects layer sizes */
}
canvas {
margin: 20px;
width: 200px;
height: 200px;
padding: 0 20px;
}
.compare {
margin-left: 40px;
margin-top: 20px;
width: 200px;
height: 200px;
background-color: rgba(0, 255, 0, 1.0);
}
</style>
<script>
function initWebGL(canvasName, vshader, fshader, attribs, clearColor, clearDepth)
{
var canvas = document.getElementById(canvasName);
var gl = canvas.getContext("webgl", {alpha: false});
if (!gl) {
alert("No WebGL context found");
return null;
}
gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
gl.clearDepth(clearDepth);
return gl;
}
function drawCanvas(canvasID)
{
var gl = initWebGL(canvasID, "", "", [], [ 0, 1, 0, 0 ], 1);
gl.viewport(0, 0, 200, 200);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
}
function init()
{
drawCanvas('canvas');
}
</script>
</head>
<body onload="init()">
<div class="compare"></div>
<canvas id="canvas" width="200" height="200"></canvas>
<!-- Top and bottom should look the same. -->
</body>
</html>