Created
April 4, 2017 17:36
-
-
Save fczuardi/dbcaf59f11320c276ba6e5a9f0e2449f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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