1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

LibWeb: Add ability to present LibGL framebuffer and add clearing

This commit is contained in:
Luke Wilde 2022-06-04 04:27:48 +01:00 committed by Linus Groh
parent 68d9d4e247
commit 076c9772a4
8 changed files with 131 additions and 1 deletions

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>WebGL Demo - Multiple Contexts and glClear(Color)</title>
<style>
.border {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>WebGL Demo - Multiple Contexts and glClear(Color)</h1>
<canvas id="webgl-canvas1" class="border"></canvas>
<canvas id="webgl-canvas2" class="border"></canvas>
<script>
"use strict";
const canvas1 = document.getElementById("webgl-canvas1");
const webglContext1 = canvas1.getContext("webgl");
const canvas2 = document.getElementById("webgl-canvas2");
const webglContext2 = canvas2.getContext("webgl");
function clearWithRandomColor() {
webglContext1.clearColor(Math.random(), Math.random(), Math.random(), Math.random());
webglContext1.clear(webglContext1.COLOR_BUFFER_BIT);
webglContext2.clearColor(Math.random(), Math.random(), Math.random(), Math.random());
webglContext2.clear(webglContext2.COLOR_BUFFER_BIT);
}
clearWithRandomColor();
setInterval(clearWithRandomColor, 1000);
</script>
</body>
</html>

View file

@ -176,6 +176,7 @@
<li><a href="img-canvas.html">canvas drawImage() test</a></li>
<li><a href="canvas-path.html">canvas path house!</a></li>
<li><a href="trigonometry.html">canvas + trigonometry functions</a></li>
<li><a href="webgl-clear-color-and-multiple-contexts.html">WebGL Demo - Multiple Contexts and glClear(Color)</a></li>
<li><h3>Wasm</h3></li>
<li><a href="mandelbrot-wasm.html">WebAssembly Mandelbrot Rendering Demo</a></li>
<li><a href="gol-wasm.html">WebAssembly Game Of Life Demo</a></li>