src/typedarrays.js
function getGLTypeForTypedArray(typedArray) {
  if (typedArray instanceof Int8Array)         { return BYTE; }           // eslint-disable-line
  if (typedArray instanceof Uint8Array)        { return UNSIGNED_BYTE; }  // eslint-disable-line
  if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE; }  // eslint-disable-line
  if (typedArray instanceof Int16Array)        { return SHORT; }          // eslint-disable-line
  if (typedArray instanceof Uint16Array)       { return UNSIGNED_SHORT; } // eslint-disable-line
  if (typedArray instanceof Int32Array)        { return INT; }            // eslint-disable-line
  if (typedArray instanceof Uint32Array)       { return UNSIGNED_INT; }   // eslint-disable-line
  if (typedArray instanceof Float32Array)      { return FLOAT; }          // eslint-disable-line
  throw "unsupported typed array type";
}
function getGLTypeForTypedArray(typedArray) {
  if (typedArray instanceof Int8Array)         { return BYTE; }           // eslint-disable-line
  if (typedArray instanceof Uint8Array)        { return UNSIGNED_BYTE; }  // eslint-disable-line
  if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE; }  // eslint-disable-line
  if (typedArray instanceof Int16Array)        { return SHORT; }          // eslint-disable-line
  if (typedArray instanceof Uint16Array)       { return UNSIGNED_SHORT; } // eslint-disable-line
  if (typedArray instanceof Int32Array)        { return INT; }            // eslint-disable-line
  if (typedArray instanceof Uint32Array)       { return UNSIGNED_INT; }   // eslint-disable-line
  if (typedArray instanceof Float32Array)      { return FLOAT; }          // eslint-disable-line
  throw "unsupported typed array type";
}
function getGLTypeForTypedArray ( typedArray ) { if ( typedArray instanceof Int8Array ) { return BYTE ; } // eslint-disable-line if ( typedArray instanceof Uint8Array ) { return UNSIGNED_BYTE ; } // eslint-disable-line if ( typedArray instanceof Uint8ClampedArray ) { return UNSIGNED_BYTE ; } // eslint-disable-line if ( typedArray instanceof Int16Array ) { return SHORT ; } // eslint-disable-line if ( typedArray instanceof Uint16Array ) { return UNSIGNED_SHORT ; } // eslint-disable-line if ( typedArray instanceof Int32Array ) { return INT ; } // eslint-disable-line if ( typedArray instanceof Uint32Array ) { return UNSIGNED_INT ; } // eslint-disable-line if ( typedArray instanceof Float32Array ) { return FLOAT ; } // eslint-disable-line throw "unsupported typed array type" ; }
Get the GL type for a typedArray
@param {ArrayBufferView} typedArray a typedArray
@return {number} the GL type for array. For example pass in an `Int8Array` and `gl.BYTE` will
be returned. Pass in a `Uint32Array` and `gl.UNSIGNED_INT` will be returned
@memberOf module:twgl/typedArray
Get the GL type for a typedArray