WebGL example for beginners in computer graphics

It is my example how to draw a triangle using WebGL and TypeScript: https://plnkr.co/edit/PkqSZGwhv9zKSnUNSiXo?p=preview Just fork my example, change it, save and send a new link to your friends. I use glMatrix library for math. You can find in the ShaderProgram.ts file hwo I set scale, rotation, and translation: let modelMatrix = mat4.create(); mat4.translate(modelMatrix, modelMatrix, vec3.fromValues(0, 0.5, 0)); mat4.rotateZ(modelMatrix, modelMatrix, 20.0 * Math.PI / 180.0); mat4.scale(modelMatrix, modelMatrix, vec3.fromValues(0.5, 0.5, 1)); let u_ModelMatrix = gl.getUniformLocation(this.program, “u_ModelMatrix”); gl.uniformMatrix4fv(u_ModelMatrix, false, modelMatrix);

Published by CelleSports Mill

CelleSports is a Game development, News outlet, and Social Cell community. Build your cells or teams for any game and start communicating efficiently. Join us in building the number one eSport and gaming community in the World. Join Cell eSports

Leave a comment