Webgl and Typescript Guide 1. | Lets Clear

in guide •  6 years ago 

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

@lonzo23, congratulations on making your first post! I gave you an upvote!
Please take a moment to read this post regarding commenting and spam. (tl;dr - if you spam, you will be flagged!)

Congratulations @lonzo23! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You made your First Vote
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Congratulations @lonzo23! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update
Vote for @Steemitboard as a witness to get one more award and increased upvotes!