This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

Webgl and Typescript Guide 1. | Lets Clear

lonzo23(25)
Published in
#guide
Words
28
Reading
1 min
Listen
Play
8y

In the following Github example, init webgl, the clearing, size in html, pixels in canvas.

Init Webgl:
canvas.getContext("webgl2");

Clear:
gl.clearColor(1.0,0.0,0.0,1.0);
this.clear(this.COLOR_BUFFER_BIT | this.DEPTH_BUFFER_BIT);

Size in html:
this.canvas.style.width = width;
this.canvas.style.height = height;

Pixels in Canvas:
this.viewport(0, 0, width, height);

The result is:
Rad.png

Github:
https://github.com/19Kuschel90/Webgl-Guide

Webgl and Typescript Guide 1. | Lets Clear | Ecency