setupField = regl({
vert: `
${customGlsl.precision}
attribute vec2 position;
varying vec2 uv;
void main() {
// Convert (-1, 1) to (0, 1)
uv = 0.5 * position + 0.5;
gl_Position = vec4(position, 0.0, 1.0);
}`,
frag: `
${customGlsl.precision}
varying vec2 uv;
uniform sampler2D prevState;
void main() {
vec4 color = texture2D(prevState, uv);
gl_FragColor = vec4(color.xyz, 1.0);
}`,
attributes: {
position: [-4, -4, 4, -4, 0, 4]
},
count: 3,
depth: false,
uniforms: {
prevState: ({ tick }) => state[tick % 2],
tick: ({ tick }) => tick
}
})