懒惰的一周~
http://www.cnblogs.com/easymind223/archive/2012/07/05/2578231.html
http://glslsandbox.com/e#21606.0
↑根据它们的指导做出来的Mandelbrot集~
#version 440
#define r 300.0
uniform int _t;
vec2 center = vec2(1366.0 / 2.0, 768.0 / 2.0);
void main()
{
vec2 c = vec2((gl_FragCoord.x - center.x) / r, (gl_FragCoord.y - center.y) / r);
vec3 color;
vec2 z = c;
float a = 0;
for(int i = 0;i < 64;i++)
{
a = float(i);
z = vec2(z.x * z.x - z.y * z.y, 2 * z.x * z.y) + c;
if(length(z) > 32)
break;
}
gl_FragColor = vec4(vec3(a / float(20)), 1.0);
}
时间: 2024-10-12 03:26:34