Skip to content

Instantly share code, notes, and snippets.

@fczuardi
Created April 4, 2017 17:36
Show Gist options
  • Save fczuardi/dbcaf59f11320c276ba6e5a9f0e2449f to your computer and use it in GitHub Desktop.
Save fczuardi/dbcaf59f11320c276ba6e5a9f0e2449f to your computer and use it in GitHub Desktop.
const Regl = require('regl');
const example = (root) => () => {
const regl = Regl(root);
regl({
framebuffer: regl.framebuffer(2),
attributes: {
position: [
[-1, -1, 0],
[-1, 1, 0],
[1, 1, 0],
[1, -1, 0],
[-1, -1, 0],
]
},
primitive: 'triangle strip',
count: 5,
vert: `
attribute vec3 position;
void main(){
gl_Position = vec4(position, 1);
}
`,
frag: `
void main() {
gl_FragColor = vec4(0.5, 0.5, 0.5, 1);
}
`
})(() => {
regl.draw();
console.log(regl.read().toString());
})
}
module.exports = example;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment