1.0.0 • Published 10 years ago
gl-texture2d-pip v1.0.0
gl-texture2d-pip
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.
Usage
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_FACEandgl.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.
1.0.0
10 years ago

