-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcopy.js
34 lines (33 loc) · 784 Bytes
/
copy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"use strict";
export function createRenderer(regl) {
return regl({
vert: `
precision highp float;
attribute vec2 position;
attribute vec2 uv;
varying vec2 vUV;
void main() {
gl_Position = vec4(position, 0, 1);
vUV = uv;
}
`,
frag: `
precision highp float;
uniform sampler2D source;
varying vec2 vUV;
void main() {
gl_FragColor = texture2D(source, vUV);
}
`,
attributes: {
position: regl.buffer([-1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1]),
uv: regl.buffer([0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1])
},
uniforms: {
source: regl.prop('source'),
},
framebuffer: regl.prop('destination'),
viewport: regl.prop('viewport'),
count: 6
});
}