summaryrefslogtreecommitdiff
path: root/Base/res
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-06-04 04:27:48 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-13 21:45:27 +0100
commit076c9772a4ce2a1fe2a6ce39a0d787f3d4bea488 (patch)
tree7cc7de5c98ae81d99af6e24b9775d18364bd941c /Base/res
parent68d9d4e247bb0aca76e8bddf231ed561a0231312 (diff)
downloadserenity-076c9772a4ce2a1fe2a6ce39a0d787f3d4bea488.zip
LibWeb: Add ability to present LibGL framebuffer and add clearing
Diffstat (limited to 'Base/res')
-rw-r--r--Base/res/html/misc/webgl-clear-color-and-multiple-contexts.html34
-rw-r--r--Base/res/html/misc/welcome.html1
2 files changed, 35 insertions, 0 deletions
diff --git a/Base/res/html/misc/webgl-clear-color-and-multiple-contexts.html b/Base/res/html/misc/webgl-clear-color-and-multiple-contexts.html
new file mode 100644
index 0000000000..6855126558
--- /dev/null
+++ b/Base/res/html/misc/webgl-clear-color-and-multiple-contexts.html
@@ -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>
diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html
index 65a648f736..e1aafcd06f 100644
--- a/Base/res/html/misc/welcome.html
+++ b/Base/res/html/misc/welcome.html
@@ -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>