vertexShader = {
const shader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(shader, `
precision highp float;
const float PI = 3.14159265359;
const float alpha = ${alpha};
attribute vec2 position;
attribute vec3 color;
varying highp vec3 vColor;
void main() {
float x1, x2 = position.x;
float y1, y2 = position.y;
vColor = color;
for (int i = 0; i < ${iterations}; i++) {
x1 = x2, y1 = y2;
x2 = x1 * cos(alpha) - (y1 - x1*x1)*sin(alpha);
y2 = x1 * sin(alpha) + (y1 - x1*x1)*cos(alpha);
}
gl_Position = vec4(x2, y2, 0.0, 1.0);
gl_PointSize = 2.0;
}
`);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) throw gl.getShaderInfoLog(shader);
invalidation.then(() => gl.deleteShader(shader));
return shader;
}