diff --git a/index.html b/index.html index 78692eeacdc1ca2dc57abedee03d8789d3d926d1..afdb0a839cbcfa32592116c9d98b3bcb1eb92664 100644 --- a/index.html +++ b/index.html @@ -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); diff --git a/main.js b/main.js index 61c5c964836c6a4637d8dc413cb654c296ec77b8..7eb89304c758bf316f573ea50f9c47530e4946c5 100755 --- a/main.js +++ b/main.js @@ -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);