src/framebuffers.js
function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) {
  width  = width  || gl.drawingBufferWidth;
  height = height || gl.drawingBufferHeight;
  framebufferInfo.width = width;
  framebufferInfo.height = height;
  attachments = attachments || defaultAttachments;
  attachments.forEach(function(attachmentOptions, ndx) {
    const attachment = framebufferInfo.attachments[ndx];
    const format = attachmentOptions.format;
    if (helper.isRenderbuffer(gl, attachment)) {
      gl.bindRenderbuffer(gl.RENDERBUFFER, attachment);
      gl.renderbufferStorage(gl.RENDERBUFFER, format, width, height);
    } else if (helper.isTexture(gl, attachment)) {
      textures.resizeTexture(gl, attachment, attachmentOptions, width, height);
    } else {
      throw "unknown attachment type";
    }
  });
}
function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) {
  width  = width  || gl.drawingBufferWidth;
  height = height || gl.drawingBufferHeight;
  framebufferInfo.width = width;
  framebufferInfo.height = height;
  attachments = attachments || defaultAttachments;
  attachments.forEach(function(attachmentOptions, ndx) {
    const attachment = framebufferInfo.attachments[ndx];
    const format = attachmentOptions.format;
    if (helper.isRenderbuffer(gl, attachment)) {
      gl.bindRenderbuffer(gl.RENDERBUFFER, attachment);
      gl.renderbufferStorage(gl.RENDERBUFFER, format, width, height);
    } else if (helper.isTexture(gl, attachment)) {
      textures.resizeTexture(gl, attachment, attachmentOptions, width, height);
    } else {
      throw "unknown attachment type";
    }
  });
}
function resizeFramebufferInfo ( gl , framebufferInfo , attachments , width , height ) { width = width || gl . drawingBufferWidth ; height = height || gl . drawingBufferHeight ; framebufferInfo . width = width ; framebufferInfo . height = height ; attachments = attachments || defaultAttachments ; attachments . forEach ( function ( attachmentOptions , ndx ) { const attachment = framebufferInfo . attachments [ ndx ] ; const format = attachmentOptions . format ; if ( helper . isRenderbuffer ( gl , attachment ) ) { gl . bindRenderbuffer ( gl . RENDERBUFFER , attachment ) ; gl . renderbufferStorage ( gl . RENDERBUFFER , format , width , height ) ; } else if ( helper . isTexture ( gl , attachment ) ) { textures . resizeTexture ( gl , attachment , attachmentOptions , width , height ) ; } else { throw "unknown attachment type" ; } } ) ; }
Resizes the attachments of a framebuffer.

You need to pass in the same `attachments` as you passed in {@link module:twgl.createFramebufferInfo}
because TWGL has no idea the format/type of each attachment.

The simplest usage

// create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer
const fbi = twgl.createFramebufferInfo(gl);

...

function render() {
if (twgl.resizeCanvasToDisplaySize(gl.canvas)) {
// resize the attachments
twgl.resizeFramebufferInfo(gl, fbi);
}

More complex usage

// create an RGB565 renderbuffer and a STENCIL_INDEX8 renderbuffer
const attachments = [
{ format: RGB565, mag: NEAREST },
{ format: STENCIL_INDEX8 },
]
const fbi = twgl.createFramebufferInfo(gl, attachments);

...

function render() {
if (twgl.resizeCanvasToDisplaySize(gl.canvas)) {
// resize the attachments to match
twgl.resizeFramebufferInfo(gl, fbi, attachments);
}

@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {module:twgl.FramebufferInfo} framebufferInfo a framebufferInfo as returned from {@link module:twgl.createFramebufferInfo}.
@param {module:twgl.AttachmentOptions[]} [attachments] the same attachments options as passed to {@link module:twgl.createFramebufferInfo}.
@param {number} [width] the width for the attachments. Default = size of drawingBuffer
@param {number} [height] the height for the attachments. Defautt = size of drawingBuffer
@memberOf module:twgl/framebuffers
Resizes the attachments of a framebuffer .