src/textures.js
function setEmptyTexture(gl, tex, options) {
  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;
  const type = options.type || formatType.type;
  savePackState(gl, options);
  if (target === gl.TEXTURE_CUBE_MAP) {
    for (let ii = 0; ii < 6; ++ii) {
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, options.width, options.height, 0, format, type, null);
    }
  } else if (target === gl.TEXTURE_3D) {
    gl.texImage3D(target, level, internalFormat, options.width, options.height, options.depth, 0, format, type, null);
  } else {
    gl.texImage2D(target, level, internalFormat, options.width, options.height, 0, format, type, null);
  }
  restorePackState(gl, options);
}
function setEmptyTexture(gl, tex, options) {
  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;
  const type = options.type || formatType.type;
  savePackState(gl, options);
  if (target === gl.TEXTURE_CUBE_MAP) {
    for (let ii = 0; ii < 6; ++ii) {
      gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, options.width, options.height, 0, format, type, null);
    }
  } else if (target === gl.TEXTURE_3D) {
    gl.texImage3D(target, level, internalFormat, options.width, options.height, options.depth, 0, format, type, null);
  } else {
    gl.texImage2D(target, level, internalFormat, options.width, options.height, 0, format, type, null);
  }
  restorePackState(gl, options);
}
function setEmptyTexture ( gl , tex , options ) { 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 ; const type = options . type || formatType . type ; savePackState ( gl , options ) ; if ( target === gl . TEXTURE_CUBE_MAP ) { for ( let ii = 0 ; ii < 6 ; ++ ii ) { gl . texImage2D ( gl . TEXTURE_CUBE_MAP_POSITIVE_X + ii , level , internalFormat , options . width , options . height , 0 , format , type , null ) ; } } else if ( target === gl . TEXTURE_3D ) { gl . texImage3D ( target , level , internalFormat , options . width , options . height , options . depth , 0 , format , type , null ) ; } else { gl . texImage2D ( target , level , internalFormat , options . width , options . height , 0 , format , type , null ) ; } restorePackState ( gl , options ) ; }
Sets a texture with no contents of a certain size. In other words calls `gl.texImage2D` with `null`.
You must set `options.width` and `options.height`.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {WebGLTexture} tex the WebGLTexture to set parameters for
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
@memberOf module:twgl/textures
Sets a texture with no contents of a certain size . In other words calls gl . texImage2D with null . You must set options . width and options . height .