static const char* vsh="\
void main()\
{\
	gl_Position = ftransform();\
	gl_FrontColor.xyz = gl_Normal;\
	gl_TexCoord[0] = gl_MultiTexCoord0;\
}";
static const char* supershape_vs="\
#extension GL_EXT_gpu_shader4 : require\n\
#extension GL_ARB_draw_instanced : require\n\
uniform vec4 c;uniform vec4 d;\
uniform int offset;\
varying vec3 n,half,w;varying float z;\
varying vec4 bc;\
float r(vec3 p)\
{\
  p.x+=p.y*57.+p.z*21.;\
  return fract(p.x*p.x*.0013)*2.-1.;\
}\
float s(vec4 k,float p){return pow(pow(abs(cos(k.x*p/4.)),k.y)+pow(abs(sin(k.x*p/4.)),k.z),k.w);}\
vec4 o(vec4 p){\
	vec4 q;\
	float r1=s(c,p.x),r2=s(d,p.y);\
	q.x=r1*cos(p.x)*r2*cos(p.y);\
	q.y=r1*sin(p.x)*r2*cos(p.y);\
	q.z=r2*sin(p.y);\
	q.w=1.;\
	return q;\
}\
void main() {\
	int num=gl_InstanceID+offset;\
	vec4 p=gl_Vertex;\
	vec4 q=o(p);\
	w=q.xyz;\
	q+=vec4(0.,2.,0.,0.)*(num%15)+vec4(2.,0.,0.,0.)*((gl_InstanceID)/15);\
	q+=vec4(0.,0.,.7,0.)*(r(num%137)-r(0));\
	if(num%33==1) {\
		bc=vec4(0.4,1.7,0.4,0.3);\
		q.z*=3.;\
	} else {\
		bc=0.3*(r(num%317)-r(0))+vec4(0.15,0.25,0.4,1.);\
	}\
	gl_Position=gl_ModelViewProjectionMatrix*q;\
	z=gl_Position.z;\
	n=normalize(gl_NormalMatrix*(cross(o(p+vec4(0.01,0.,0.,0.)).xyz-w,o(p+vec4(0.,cos(p.y)*0.01,0.,0.)).xyz-w)));\
	vec3 eye=(normalize(gl_ModelViewMatrix*q)).xyz;\
	half=0.5*(normalize(vec3(1.,-1.,-2.))+eye);\
}";
static const char* floor_vs="\
varying vec3 n,half,w;varying float z;\
void main() {\
	gl_Position=ftransform();\
	n=vec3(0.,1.,0.);\
	w=gl_Vertex.xyz*50.;\
	gl_TexCoord[0]=gl_MultiTexCoord0;\
	z=gl_Position.z;\
}";
static const char* fake_color_fs="\
void main() {\
	gl_FragColor=vec4(1.,1.,1.,1.);\
}";
static const char* strobotext_vs="\
uniform vec4 c;uniform vec4 d;\
uniform int offset;\
varying vec3 n,half,w;varying float z;\
varying vec4 bc;\
void main() {\
	vec4 p=gl_Vertex;\
	vec4 q=p;\
	w=q.xyz;\
	gl_Position=ftransform();\
	z=gl_Position.z;\
	n=normalize(gl_NormalMatrix*gl_Normal);\
	vec3 eye=(normalize(gl_ModelViewMatrix*q)).xyz;\
	half=0.5*(normalize(vec3(1.,-1.,-2.))+eye);\
}";
static const char* supershape_fs="\
varying vec3 n,half,w; varying float z;\
float fade(float t){return t*t*t*(t*(t*6.-15.)+10.);}\
float r(vec3 c){\
	return fract(sin(dot(c,vec3(12.9898,78.233,9.7286)))*43758.5453);\
}\
float noise(vec3 c){\
	vec3 i=floor(c);\
	vec3 f=vec3(fade(c.x-i.x),fade(c.y-i.y),fade(c.z-i.z));\
	return mix(mix(mix(r(i),r(i+vec3(1.,0.,0.)),f.x),mix(r(i+vec3(0.,1.,0.)),r(i+vec3(1.,1.,0.)),f.x),f.y),mix(mix(r(i+vec3(0.,0.,1.)),r(i+vec3(1.,0.,1.)),f.x),mix(r(i+vec3(0.,1.,1.)),r(i+vec3(1.,1.,1.)),f.x),f.y),f.z);\
}\
float turbulence(vec3 v){\
	float t;\
	for(float f=3.;f<=36.;f*=2.)t+=noise(v*f)/f;\
	return t;\
}\
void main() {\
	vec3 l=normalize(vec3(-1.,1.,2.));\
	vec3 m=normalize(n+vec3(turbulence(w)-.5,turbulence(2.*w)-.5,turbulence(1.4*w)-.5));\
	vec4 c=vec4(.1*turbulence(0.5*w));c.a=1.;\
	c+=0.35*vec4(.8,.8,.8,0.)*clamp(dot(m,l),0.,1.);\
	c+=vec4(1.,1.,.4,0.)*pow(max(dot(m,normalize(-half)),0.),29.);\
	gl_FragColor=mix(vec4(.05,.1,.2,1.),c,exp(-z/400.));\
}";
static const char* bloom_fs="\
uniform sampler2D t;\
void main(){\
  vec2 p=gl_TexCoord[0].xy;\
	gl_FragColor=3.5*pow(texture2D(t,p),vec4(2.));\
}";

static const char* blur_h="\
uniform sampler2D t;\
void main(){\
  vec4 m;\
  vec2 p=gl_TexCoord[0].xy;\
	vec2 n;\
	for(int i=-4; i<5; i++) {\
		n.x = float(i*i*sign(i))/800.;\
		n.y=0;\
		m += texture2D(t, p + n);\
	}\
	gl_FragColor=m/9.;\
}";

static const char* blur_v="\
uniform sampler2D t;\
void main(){\
  vec4 m;\
  vec2 p=gl_TexCoord[0].xy;\
	vec2 n;\
	for(int i=-4; i<5; i++) {\
		n.y = float(i*i*sign(i))/600.;\
		n.x=0;\
		m += texture2D(t, p + n);\
	}\
	gl_FragColor=m/9.;\
}";
static const char* blur_rad="\
uniform sampler2D t;\
uniform float bluramount;\
void main(){\
  vec4 m;\
  vec2 p=2.*gl_TexCoord[0].xy-1.;\
	vec2 n;\
	for(int i=1; i<9; i++) {\
		n = p*(1.-i*i*bluramount/10.);\
		m += texture2D(t, (n+1.)*.5);\
	}\
	gl_FragColor=m/8.;\
}";
static const char* postproc_fsh="\
uniform sampler2D t;\
void main(){\
  vec4 m;\
  vec2 p=gl_TexCoord[0].xy;\
	m = texture2D(t,p);\
	m += pow(m,vec4(1.5))*.33;\
  p-=vec2(.5);p*=1.1;\
  m.a=0.4;\
	gl_FragColor=m*(1. - 10.*pow(pow(p.x*p.x,4.)+pow(p.y*p.y,4.),0.6));\
}";

