webGL

HTML

<body onload="start()">
  <canvas id="glcanvas" width="640" height="480">
    No webGL.
  </canvas>
</body>

JavaScript

function start() {
  var canvas = document.getElementById("glcanvas");

  gl = canvas.getContext("webgl")
  
  if (gl) {
    gl.clearColor(1.0, 0.0, 0.0, 1.0);
    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
  }
}

  const vsSource = `
    attribute vec4 aVertexPosition;

    uniform mat4 uModelViewMatrix;
    uniform mat4 uProjectionMatrix;

    void main() {
      gl_Position = uProjectionMatrix * uModelViewMatrix * aVertexPosition;
    }
  `;
  
   const fsSource = `
    void main() {
      gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
    }
  `;