let GL say Hello World

This commit is contained in:
Julian
2020-01-20 12:24:57 +01:00
parent cb79eff4d6
commit 2f0ce2c7b4
5 changed files with 91 additions and 4 deletions

View File

@@ -1 +0,0 @@
console.log("Hello World!")

16
src/main.ts Normal file
View File

@@ -0,0 +1,16 @@
main();
function main() {
const canvas: HTMLCanvasElement = <HTMLCanvasElement>document.getElementById("window");
const gl = canvas.getContext("webgl");
if (!gl) {
alert("Unable to initialize WebGL. Your browser or machine may not support it.");
return;
}
// Setze clear color auf schwarz, vollständig sichtbar
gl.clearColor(0.0, 1.0, 0.0, 1.0);
// Lösche den color buffer mit definierter clear color
gl.clear(gl.COLOR_BUFFER_BIT);
}