From b8693ebef1ea817d123a912ef711c427f8de87f3 Mon Sep 17 00:00:00 2001
From: amandaghassaei <amandaghassaei@gmail.com>
Date: Mon, 3 Apr 2017 01:07:05 -0400
Subject: [PATCH] small changes

---
 index.html |  2 +-
 main.js    | 19 ++++++++-----------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/index.html b/index.html
index 567fe1e..bf4df93 100644
--- a/index.html
+++ b/index.html
@@ -75,7 +75,7 @@
             float w = texture2D(u_velocity, (fragCoord+vec2(-1.0, 0.0))/u_textureSize).x;
 
             float div = u_const*(e-w + n-s);
-            gl_FragColor = vec4(div, div, 0, 0);
+            gl_FragColor = vec4(div, 0, 0, 0);
         }
     </script>
 
diff --git a/main.js b/main.js
index 4a8a2e5..24f3bd3 100755
--- a/main.js
+++ b/main.js
@@ -75,24 +75,21 @@ function render(){
 
     if (!paused) {
 
-        // Apply the first 3 operators in Equation 12.
-        // u = advect(u);
-        // u = diffuse(u);
-        // u = addForces(u);
-        // // Now apply the projection operator to the result.
-        // p = computePressure(u);
-        // u = subtractPressureGradient(u, p);
-
-        GPU.step("advect", ["velocity", "velocity"], "nextVelocity");//advect velocity
+        //advect velocity
+        GPU.step("advect", ["velocity", "velocity"], "nextVelocity");
         GPU.swapTextures("velocity", "nextVelocity");
+
+        //diffuse velocity
         GPU.setProgram("jacobi");
         var alpha = dx*dx/(nu*dt);
         GPU.setUniformForProgram("jacobi", "u_alpha", alpha, "1f");
         GPU.setUniformForProgram("jacobi", "u_reciprocalBeta", 1/(4+alpha), "1f");
         for (var i=0;i<3;i++){
-            GPU.step("jacobi", ["velocity", "velocity"], "nextVelocity");//diffuse velocity
-            GPU.step("jacobi", ["nextVelocity", "nextVelocity"], "velocity");//diffuse velocity
+            GPU.step("jacobi", ["velocity", "velocity"], "nextVelocity");
+            GPU.step("jacobi", ["nextVelocity", "nextVelocity"], "velocity");
         }
+
+        //apply force
         GPU.setProgram("force");
         if (mouseEnable){
             GPU.setUniformForProgram("force", "u_mouseEnable", 1.0, "1f");
-- 
GitLab