Coming soon...
void main(){ gl_Position = vec4(position,1.0); } void main(){ gl_Position = vec4(position,1.0); } uniform vec2 size; uniform sampler2D data; uniform sampler2D oldData; uniform vec2 mousePos; void main() { vec2 index = vec2(gl_FragCoord.x/size.x,gl_FragCoord.y/size.y); vec2 indexTop = vec2(gl_FragCoord.x/size.x,(gl_FragCoord.y+1.0)/size.y); vec2 indexBottom = vec2(gl_FragCoord.x/size.x,(gl_FragCoord.y-1.0)/size.y); vec2 indexLeft = vec2((gl_FragCoord.x-1.0)/size.x,gl_FragCoord.y/size.y); vec2 indexRight = vec2((gl_FragCoord.x+1.0)/size.x,gl_FragCoord.y/size.y); float fak = 0.5; vec4 dt = (texture2D(data, indexTop) - texture2D(data, index)); vec4 db = (texture2D(data, indexBottom) - texture2D(data, index)); vec4 dl = (texture2D(data, indexLeft) - texture2D(data, index)); vec4 dr = (texture2D(data, indexRight) - texture2D(data, index)); vec4 dtime = (texture2D(data, index) - texture2D(oldData, index)); vec4 dN = texture2D(data, index); vec4 force = fak*dt + fak*db + fak*dr + fak*dl; float vel = dN.y + force.x; float pos = dN.x + vel; if(length(index-mousePos) < 0.02){ pos += 12.0*pow(1.0 - 50.0*length(index-mousePos),3.0); } /* if(length(index.y-0.3) < 0.01){ if(length(index.x-0.4) > 0.01){ if(length(index.x-0.6) > 0.01){ pos = 0.0; } } } */ //sum += texture2D(data, indexLeft) + texture2D(data, indexRight); //vec4 res = texture2D(data, index) + dtime/1000.0; gl_FragColor = vec4(pos*0.99,vel*0.999,0.0,1.0); } uniform float height; uniform float width; uniform vec2 size; uniform sampler2D data; void main() { vec2 index = ((gl_FragCoord.xy) / vec2(width,height)); vec2 pv = texture2D(data, index).xy; float red = pv.x/3.0; float green = (pv.x-0.4)/20.0; float blue = (pv.x-20.0)/20.0; gl_FragColor = vec4(red,green,blue,1.0); }