X-Git-Url: https://codewiz.org/gitweb?p=mandelwow.git;a=blobdiff_plain;f=mandelwow.frag;h=c2e4e2d728c2fb45b36b49c26bd1e56fc3583389;hp=3795fd46efcecef10ac54fc6a781e58f59936737;hb=595fa92af6e72783e2b7624f5b8e5f5418d4e757;hpb=1124bb2dc1b8381bf4bfc437ab1689ec1b30d99b diff --git a/mandelwow.frag b/mandelwow.frag index 3795fd4..c2e4e2d 100644 --- a/mandelwow.frag +++ b/mandelwow.frag @@ -1,28 +1,25 @@ -#version 140 +#version 100 precision highp float; -in vec2 c; -in vec2 z; -out vec4 f_color; +varying vec2 c; +varying vec2 z; void main() { float zx = z.x; float zy = z.y; - int maxiter = 64; - int iter = maxiter; - while (iter > 0) { + 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); - f_color = vec4(index, 0.1, 0.5 - index / 2, 0.8 - index); + gl_FragColor = vec4(index, 0.1, 1.0 - index / 2.0, 0.8 - index); return; } zy = zx * zy * 2.0 + c.y; zx = zx2 - zy2 + c.x; - iter -= 1; } - f_color = vec4((sin(z.y) + 1.0) / 2, - (sin(c.y) + 1.0) / 2, - (sin(c.x) + 1.0) / 2, - 1.0); + 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); }