Initialization

The initialization section includes everything that must be done exactly once at the beginning of the application's execution, and this includes setting up texture mapping.

〈Initialization〉 ≡
  var canvas
  var gl

  function init()
    canvas = document.getElementById('webgl')
    gl     = getWebGLContext(canvas, false)
    〈Shader Initialization〉
    〈Buffer Initialization〉
    〈Texture Initialization〉

    Request the first animation frame.