src/textures.js
function resizeTexture(gl, tex, options, width, height) {
  width = width || options.width;
  height = height || options.height;
  const target = options.target || gl.TEXTURE_2D;
  gl.bindTexture(target, tex);
  const level = options.level || 0;
  const internalFormat = options.internalFormat || options.format || gl.RGBA;
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
  const format = options.format || formatType.format;
  let type;
  const src = options.src;
  if (!src) {
    type = options.type || formatType.type;
  } else if (isArrayBuffer(src) || (Array.isArray(src) && typeof (src[0]) === 'number')) {
    type = options.type || getTextureTypeForArrayType(gl, src, formatType.type);
  } else {
    type = options.type || formatType.type;
  }
  if (target === gl.TEXTURE_CUBE_MAP) {
    for (let ii = 0; ii < 6; ++ii) {
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, width, height, 0, format, type, null);
    }
  } else {
    gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, null);
  }
}
function resizeTexture(gl, tex, options, width, height) {
  width = width || options.width;
  height = height || options.height;
  const target = options.target || gl.TEXTURE_2D;
  gl.bindTexture(target, tex);
  const level = options.level || 0;
  const internalFormat = options.internalFormat || options.format || gl.RGBA;
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
  const format = options.format || formatType.format;
  let type;
  const src = options.src;
  if (!src) {
    type = options.type || formatType.type;
  } else if (isArrayBuffer(src) || (Array.isArray(src) && typeof (src[0]) === 'number')) {
    type = options.type || getTextureTypeForArrayType(gl, src, formatType.type);
  } else {
    type = options.type || formatType.type;
  }
  if (target === gl.TEXTURE_CUBE_MAP) {
    for (let ii = 0; ii < 6; ++ii) {
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, width, height, 0, format, type, null);
    }
  } else {
    gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, null);
  }
}
function resizeTexture ( gl , tex , options , width , height ) { width = width || options . width ; height = height || options . height ; const target = options . target || gl . TEXTURE_2D ; gl . bindTexture ( target , tex ) ; const level = options . level || 0 ; const internalFormat = options . internalFormat || options . format || gl . RGBA ; const formatType = getFormatAndTypeForInternalFormat ( internalFormat ) ; const format = options . format || formatType . format ; let type ; const src = options . src ; if ( ! src ) { type = options . type || formatType . type ; } else if ( isArrayBuffer ( src ) || ( Array . isArray ( src ) && typeof ( src [ 0 ] ) === 'number' ) ) { type = options . type || getTextureTypeForArrayType ( gl , src , formatType . type ) ; } else { type = options . type || formatType . type ; } if ( target === gl . TEXTURE_CUBE_MAP ) { for ( let ii = 0 ; ii < 6 ; ++ ii ) { gl . texImage2D ( gl . TEXTURE_CUBE_MAP_POSITIVE_X + ii , level , internalFormat , width , height , 0 , format , type , null ) ; } } else { gl . texImage2D ( target , level , internalFormat , width , height , 0 , format , type , null ) ; } }
Resizes a texture based on the options passed in.

Note: This is not a generic resize anything function.
It's mostly used by {@link module:twgl.resizeFramebufferInfo}
It will use `options.src` if it exists to try to determine a `type`
otherwise it will assume `gl.UNSIGNED_BYTE`. No data is provided
for the texture. Texture parameters will be set accordingly

@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {WebGLTexture} tex the texture to resize
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
@param {number} [width] the new width. If not passed in will use `options.width`
@param {number} [height] the new height. If not passed in will use `options.height`
@memberOf module:twgl/textures
Resizes a texture based on the options passed in .