27 lines
580 B
HTML
27 lines
580 B
HTML
<head>
|
|
<meta name="viewport" content="width=device-width">
|
|
<style>
|
|
|
|
canvas {
|
|
width: 100px;
|
|
height: 100px;
|
|
background-color: red;
|
|
border: 20px solid blue;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<canvas>
|
|
<script type="text/javascript">
|
|
|
|
var canvas = document.querySelector("canvas");
|
|
canvas.width = canvas.clientWidth * window.devicePixelRatio;
|
|
canvas.height = canvas.clientHeight * window.devicePixelRatio;
|
|
|
|
var gl = canvas.getContext("webgl");
|
|
gl.clearColor(0, 0, 0, 1);
|
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
|
|
</script>
|
|
</canvas>
|