Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

gl-texture2d-pip

1.0.0 • Public • Published

gl-texture2d-pip

stable

Preview the contents of a set of gl-texture instances alongside your main render pass. Useful for debugging framebuffer operations, especially in the case of deferred rendering.

gl-texture2d-pip

view demo

Usage

NPM

glTexture2dPIP(textures)

Takes an array of textures, where each element is an instance of gl-texture2d, and draws them to the canvas.

Note that this will update your context's GL state, namely:

  • Disabling gl.CULL_FACE and gl.DEPTH_TEST.
  • Changing the viewport.
  • Disabling the currently bound framebuffer.

You'll generally want to run this as the very last operation in your render loop.

const pip = require('gl-texture2d-pip')
 
const fbo1 = FBO(gl, [512, 512])
const fbo2 = FBO(gl, [512, 512])
const fbo3 = FBO(gl, [512, 512])
 
function render () {
  // ...update your fbo instances here...
 
  pip([
    fbo1.color[0],
    fbo2.color[0],
    fbo3.color[0]
  ])
}

For a full usage example, see the demo code available in demo/index.js

License

MIT, see LICENSE.md for details.

install

npm i gl-texture2d-pip

Downloadsweekly downloads

0

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar