#include "GL/gl.h"
#include "SDL/SDL.h"
char*d="varying vec4 p;void main(){p=gl_Vertex;gl_Position=ftransform();}",*g="varying vec4 p;uniform vec4 b[5];float f;void main(){for(int v=0;v<5;v++){f+=b[v].z/(length(p.xy-b[v].xy)*11);}gl_FragColor=vec4(f,f,f,1);}";float x,b[20];SDL_Event f;void main(){SDL_SetVideoMode(1024,1024,0,2);int p=glCreateProgram(),v=glCreateShader(GL_VERTEX_SHADER);glShaderSource(v,1,&d,0);glCompileShader(v);glAttachShader(p,v),v=glCreateShader(GL_FRAGMENT_SHADER);glShaderSource(v,1,&g,0);glCompileShader(v);glAttachShader(p,v);glLinkProgram(p);glUseProgram(p);do{x=SDL_GetTicks()/200.0;for(v=0;v<20;v+=4){srand(v);b[v+2]=(rand()%200+100)/200.0;b[v+1]=cos((rand()%200-100)/200.0*x);b[v]=cos((rand()%200-100)/200.0*x);}glUniform4fv(glGetUniformLocation(p,"b"),5,b);glRecti(-1,-1,1,1);SDL_GL_SwapBuffers();SDL_PollEvent(&f);}while(f.type!=14&&f.type!=2);}