Commit b5342688 authored by amandaghassaei's avatar amandaghassaei

advection2d

parent 77295f7e
......@@ -53,7 +53,7 @@
}
vec2 pxCenter = vec2(0.5, 0.5);
vec2 pos = fragCoord - pxCenter + u_dt*currentVelocity;
vec2 pos = fragCoord - pxCenter - u_dt*currentVelocity;
if (pos.x < 0.0 || pos.x >= u_textureSize.x-1.0 || pos.y < 0.0 || pos.y >= u_textureSize.y-1.0){
//boundary
gl_FragColor = vec4(0);
......
......@@ -97,6 +97,7 @@ function resetWindow(){
for (var j=0;j<width;j++){
var index = 4*(i*width+j);
velocity[index] = i/100;
velocity[index+1] = j/100;
}
}
GPU.initTextureFromData("velocity", width, height, "FLOAT", velocity, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment