function resizeTexture(texture, width, height) {
  const oldWidth = texture.width;
  const oldHeight = texture.height;
  const oldPixels = readPixelsToBuffer(texture, {});

  texture.resize({width, height});

  texture.setSubImageData({
    data: oldPixels,
    x: 0,
    y: height - oldHeight,
    width: oldWidth,
    height: oldHeight,
    parameters: DEFAULT_TEXTURE_PARAMETERS
  });

  texture.generateMipmap();

  oldPixels.delete();
  return texture;
}
function resizeTexture(texture, width, height) {
  const oldWidth = texture.width;
  const oldHeight = texture.height;
  const oldPixels = readPixelsToBuffer(texture, {});

  texture.resize({width, height});

  texture.setSubImageData({
    data: oldPixels,
    x: 0,
    y: height - oldHeight,
    width: oldWidth,
    height: oldHeight,
    parameters: DEFAULT_TEXTURE_PARAMETERS
  });

  texture.generateMipmap();

  oldPixels.delete();
  return texture;
}
function resizeTexture ( texture , width , height ) { const oldWidth = texture . width ; const oldHeight = texture . height ; const oldPixels = readPixelsToBuffer ( texture , { } ) ; texture . resize ( { width , height } ) ; texture . setSubImageData ( { data : oldPixels , x : 0 , y : height - oldHeight , width : oldWidth , height : oldHeight , parameters : DEFAULT_TEXTURE_PARAMETERS } ) ; texture . generateMipmap ( ) ; oldPixels . delete ( ) ; return texture ; }
resize texture without losing original data
resize texture without losing original data
Resizes a texture to the specified size