Nevertheless! Party Metaphorically
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

kami-fbo

1.1.6 • Public • Published

kami-fbo

unstable

A 2D render-texture (frame buffer object) for use with kami.

Usage

NPM

var fbo = require('kami-fbo')(gl, {
    width: 256,
    height: 256,
    format: gl.RGB
});
 
//binds the frame buffer for your render-to-texture ops
//this also sets the viewport to the FBO size
fbo.begin();
 
// ... draw to it ...
 
//unbinds the framebuffer (binds null fbo)
//this resets the viewport to the context size
fbo.end();

Options:

  • width the width of the texture, must be >= 1
  • height the height of the texture, must be >= 1
  • format the format of the texture, default gl.RGBA
  • texture optional; a kami-texture to use instead of creating a new one

Gotchas

Calling end() resets the viewport to the context size, by querying the width and height of the passed gl context. If you've passed a simple WebGLRenderingContext, it will use the canvas width and height. This may cause problems if your canvas width and height is scaled for retina displays.

If you passed a kami-context, the width and height of the context do not represent the retina-scaled sizes, so it should be all good.

License

MIT, see LICENSE.md for details.

install

npm i kami-fbo

Downloadsweekly downloads

1

version

1.1.6

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability