Updating uniform values

uniforms are special shader variables

Finding and updating uniform variables

let canvas = undefined;  // HTML <canvas> element
let gl = undefined;      // WebGL context
let program = undefined; // Shader program

let uAngle = undefined;  // angle uniform location
let angle = 0;   // rotation angle

function init() {
    canvas = document.getElementById("webgl-canvas");
    if (!canvas) { alert("Unable to find WebGL canvas"); }

    gl = canvas.getContext("webgl2");
    if (!gl) { alert("WebGL2 isn't supported"); }

    program = initShaders(gl, "vertex-shader", "fragment-shader");
    uAngle = gl.getUniformLocation(program, "angle");

    gl.clearColor(0.25, 0.25, 0.25, 1.0);

    // Lots more stuff to come ...
}