--- /dev/null
+#version 100
+precision highp float;
+varying vec2 c;
+varying vec2 z;
+
+void main() {
+ float zx = z.x;
+ float zy = z.y;
+ const int maxiter = 64;
+ for (int iter = maxiter; iter > 0; iter--) {
+ float zx2 = zx * zx;
+ float zy2 = zy * zy;
+ if (zx2 * zy2 > 4.0) {
+ float index = float(iter) / float(maxiter);
+ gl_FragColor = vec4(index, 0.1, 1.0 - index / 2.0, 0.8 - index * index);
+ return;
+ }
+ zy = zx * zy * 2.0 + c.y;
+ zx = zx2 - zy2 + c.x;
+ }
+ gl_FragColor = vec4((sin(z.y) + 1.0) / 4.0,
+ (sin(z.x) + 1.0) / 4.0,
+ (sin(c.x) + 1.0) / 4.0,
+ 1.0);
+}
--- /dev/null
+#version 100
+uniform mat4 perspective;
+uniform mat4 view;
+uniform mat4 model;
+uniform vec2 z0;
+attribute mediump vec3 position;
+varying mediump vec2 c;
+varying mediump vec2 z;
+
+void main() {
+ mat4 modelview = view * model;
+ gl_Position = perspective * modelview * vec4(position, 1.0);
+ c = vec2(position.x, position.y);
+ z = vec2(z0.x, z0.y);
+}
--- /dev/null
+#version 300 es
+precision lowp float;
+
+flat in vec4 color;
+out vec4 color_out;
+
+void main() {
+ color_out = color;
+}
--- /dev/null
+#version 300 es
+precision lowp float;
+
+in vec3 position;
+in vec3 normal;
+flat out vec4 color; // Shaded color
+
+uniform mat4 model;
+uniform mat4 perspview;
+uniform vec3 col;
+
+void main() {
+ mat4 m = perspview * model;
+ vec3 dark = col * 0.1;
+ vec3 u_light = vec3( 0.5, -0.7, -0.6);
+ vec3 v_normal = transpose(inverse(mat3(model))) * normal;
+
+ float distance = model[3][2];
+ float attenuation = 1. / (1. + distance * distance * 0.05);
+ float brightness = max(dot(normalize(v_normal), normalize(u_light)) * attenuation, 0.0);
+ color = vec4(mix(dark, col, brightness), 1.0);
+
+ gl_Position = m * vec4(position, 1.0);
+}
--- /dev/null
+#version 300 es
+precision lowp float;
+
+out vec4 color;
+
+void main() {
+ color = vec4(1.0, 1.0, 1.0, 1.0);
+}
--- /dev/null
+#version 300 es
+precision lowp float;
+
+in vec3 position;
+uniform mat4 perspective;
+uniform mat4 view;
+uniform mat4 model;
+
+void main() {
+ mat4 modelview = view * model;
+ gl_Position = perspective * modelview * vec4(position, 1.0);
+}