design/gpu-programming/webgl/experiment/game-of-life/external/webgl-utils.js
function drawBufferInfo(gl, bufferInfo, primitiveType, count, offset) {
    var indices = bufferInfo.indices;
    primitiveType = primitiveType === undefined ? gl.TRIANGLES : primitiveType;
    var numElements = count === undefined ? bufferInfo.numElements : count;
    offset = offset === undefined ? offset : 0;
    if (indices) {
      gl.drawElements(primitiveType, numElements, gl.UNSIGNED_SHORT, offset);
    } else {
      gl.drawArrays(primitiveType, offset, numElements);
    }
  }
function drawBufferInfo(gl, bufferInfo, primitiveType, count, offset) {
    var indices = bufferInfo.indices;
    primitiveType = primitiveType === undefined ? gl.TRIANGLES : primitiveType;
    var numElements = count === undefined ? bufferInfo.numElements : count;
    offset = offset === undefined ? offset : 0;
    if (indices) {
      gl.drawElements(primitiveType, numElements, gl.UNSIGNED_SHORT, offset);
    } else {
      gl.drawArrays(primitiveType, offset, numElements);
    }
  }
function drawBufferInfo ( gl , bufferInfo , primitiveType , count , offset ) { var indices = bufferInfo . indices ; primitiveType = primitiveType === undefined ? gl . TRIANGLES : primitiveType ; var numElements = count === undefined ? bufferInfo . numElements : count ; offset = offset === undefined ? offset : 0 ; if ( indices ) { gl . drawElements ( primitiveType , numElements , gl . UNSIGNED_SHORT , offset ) ; } else { gl . drawArrays ( primitiveType , offset , numElements ) ; } }
Calls `gl.drawElements` or `gl.drawArrays`, whichever is appropriate

normally you'd call `gl.drawElements` or `gl.drawArrays` yourself
but calling this means if you switch from indexed data to non-indexed
data you don't have to remember to update your draw call.

@param {WebGLRenderingContext} gl A WebGLRenderingContext
@param {module:webgl-utils.BufferInfo} bufferInfo as returned from createBufferInfoFromArrays
@param {enum} [primitiveType] eg (gl.TRIANGLES, gl.LINES, gl.POINTS, gl.TRIANGLE_STRIP, ...)
@param {number} [count] An optional count. Defaults to bufferInfo.numElements
@param {number} [offset] An optional offset. Defaults to 0.
@memberOf module:webgl-utils
Calls gl . drawElements or gl . drawArrays whichever is appropriate