luma.gl

FrameBuffer

Class: FrameBuffer

TODO - framebuffer handling has been broken out into a separate class, but documentation is not yet up to date. For now, please refer directly to src/webgl/frame-buffer.js

Program Method: setFrameBuffer

Creates or binds/unbinds a framebuffer. You can also use this method to bind the framebuffer to a texture and renderbuffers. If the framebuffer already exists then calling setFrameBuffer with true or false as options will bind/unbind the framebuffer. Also, for all properties set to a buffer, these properties are remembered so they’re optional for later calls.

Syntax:

program.setFrameBuffer(name[, options]);

Arguments:

  1. name - (string) The name (unique id) of the buffer.
  2. options - (mixed) Can be a boolean used to bind/unbind the framebuffer or an object with options/data described below:

Options:

Examples:

Using a frambuffer to render a scene into a texture. Taken from [lesson 16]http://uber.github.io/luma.gl/examples/lessons/16/).

//create framebuffer
program.setFrameBuffer('monitor', {
  width: screenWidth,
  height: screenHeight,
  bindToTexture: {
    parameters: [{
      name: 'TEXTURE_MAG_FILTER',
      value: 'LINEAR'
    }, {
      name: 'TEXTURE_MIN_FILTER',
      value: 'LINEAR_MIPMAP_NEAREST',
      generateMipmap: false
    }]
  },
  bindToRenderBuffer: true
});

Program Method: setFrameBuffers

For each key, value of the object passed in it executes setFrameBuffer(key, value).

Syntax:

program.setFrameBuffers(object);

Arguments:

  1. object - (object) An object with key value pairs matching a buffer name and its value respectively.

Program Method: setRenderBuffer

Creates or binds/unbinds a renderbuffer. If the renderbuffer already exists and the second parameter is a boolean it’ll bind or unbind the renderbuffer.

Also, for all properties set to a buffer, these properties are remembered so they’re optional for later calls.

Syntax:

program.setRenderBuffer(name[, options]);

Arguments:

  1. name - (string) The name (unique id) of the buffer.
  2. options - (mixed) Can be a boolean used to bind/unbind the renderbuffer or an object with options/data described below:

Options:

Program Method: setRenderBuffers

For each key, value of the object passed in it executes setRenderBuffer(key, value).

Syntax:

program.setRenderBuffers(object);

Arguments:

  1. object - (object) An object with key value pairs matching a buffer name and its value respectively.