lonzo23 avatar

Webgl and Typescript Guide 1. | Lets Clear

lonzo23

Published: 11 May 2018 › Updated: 11 May 2018Webgl and Typescript Guide 1. | Lets Clear

Webgl and Typescript Guide 1. | Lets Clear

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

Leave Webgl and Typescript Guide 1. | Lets Clear to:

Written by

Read more #guide posts


Best Posts From lonzo23

We have not curated any of lonzo23's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From lonzo23