From b5342688ea929c015e534c033924098591fa3d9c Mon Sep 17 00:00:00 2001 From: amandaghassaei <amandaghassaei@gmail.com> Date: Sun, 2 Apr 2017 18:39:52 -0400 Subject: [PATCH] advection2d --- index.html | 2 +- main.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 78692ee..afdb0a8 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 61c5c96..7eb8930 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); -- GitLab