function create3x3MatrixBufferDynamicDraw(gl, _ref3) {
    var maxInstances = _ref3.maxInstances,
      attributeLoc = _ref3.attributeLoc;
    var matrixSize = 9; // 3x3 matrix
    var matrixData = new Float32Array(maxInstances * matrixSize);

    // use matrix views to set values directly into the matrixData array
    var matrixViews = new Array(maxInstances);
    for (var i = 0; i < maxInstances; i++) {
      var byteOffset = i * matrixSize * 4; // 4 bytes per float
      matrixViews[i] = new Float32Array(matrixData.buffer, byteOffset, matrixSize); // array view
    }

    var buffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
    gl.bufferData(gl.ARRAY_BUFFER, matrixData.byteLength, gl.DYNAMIC_DRAW);

    // each row of the matrix needs to be a separate attribute
    for (var _i = 0; _i < 3; _i++) {
      var loc = attributeLoc + _i;
      gl.enableVertexAttribArray(loc);
      gl.vertexAttribPointer(loc, 3, gl.FLOAT, false, 3 * 12, _i * 12);
      gl.vertexAttribDivisor(loc, 1);
    }
    gl.bindBuffer(gl.ARRAY_BUFFER, null);
    buffer.getMatrixView = function (i) {
      return matrixViews[i];
    };
    buffer.bufferSubData = function () {
      gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
      gl.bufferSubData(gl.ARRAY_BUFFER, 0, matrixData);
    };
    return buffer;
  }
Creates a buffer of 3x3 matrix data for use as attribute data.
@param {WebGLRenderingContext} gl