
uniform sampler2D src;
uniform sampler2D src2;
uniform float t;
uniform float fmix;
uniform float omix;

void main() {
//	vec4 col = texture2D(src, gl_TexCoord[0].xy);

	float scale = 2.0;

//	t = 2.2;

	vec2 z = (gl_TexCoord[0].xy-0.5)*scale;
	vec2 c = vec2(sin(t), cos(t*0.707));

	vec2 z2 = vec2(z.x*z.x-z.y*z.y, 2.0*z.x*z.y);
	vec2 pos = mix(z2+c, z, fmix);

	vec4 oc = texture2D(src2, gl_TexCoord[0].xy);

	vec4 fincol = vec4(0.0);
	if (pos.x*pos.x+pos.y*pos.y>4.0)
//	if (abs(pos.x) > scale/2.0 || abs(pos.y) > scale/2.0)
		fincol = oc;
	else
		fincol = mix(texture2D(src, pos/scale+0.5), oc, 0.1);//+vec4(0.03);

	gl_FragColor = mix(fincol, texture2D(src2, gl_TexCoord[0].xy), omix);
}
