commit 9c5b5cb6af505f26984a792076c88b493313b92f
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Fri Jun 10 13:39:35 2016 +0100

    Improce the 'Check' App.

diff --git a/src/main/java/org/distorted/examples/check/CheckActivity.java b/src/main/java/org/distorted/examples/check/CheckActivity.java
index 7c95e9e..3fcba71 100644
--- a/src/main/java/org/distorted/examples/check/CheckActivity.java
+++ b/src/main/java/org/distorted/examples/check/CheckActivity.java
@@ -38,7 +38,7 @@ public class CheckActivity extends Activity
          {
          @Override
          public void onValueChange(NumberPicker picker, int oldVal, int newVal) 
-           { 
+           {
            maxV = newVal;
            }
          });
@@ -47,7 +47,7 @@ public class CheckActivity extends Activity
          {
          @Override
          public void onValueChange(NumberPicker picker, int oldVal, int newVal) 
-           { 
+           {
            maxF = newVal;
            }
          });
@@ -91,7 +91,10 @@ public class CheckActivity extends Activity
       {
       super.onWindowFocusChanged(hasFocus);
 
-      mVPicker.setValue(1);
+      maxF = 1;
+      maxV = 2;
+
+      mVPicker.setValue(2);
       mFPicker.setValue(1);
       }
 
diff --git a/src/main/java/org/distorted/examples/check/CheckRenderer.java b/src/main/java/org/distorted/examples/check/CheckRenderer.java
index bb9d9ac..28c50a9 100644
--- a/src/main/java/org/distorted/examples/check/CheckRenderer.java
+++ b/src/main/java/org/distorted/examples/check/CheckRenderer.java
@@ -12,8 +12,12 @@ import org.distorted.examples.R;
 import org.distorted.library.Distorted;
 import org.distorted.library.DistortedBitmap;
 import org.distorted.library.EffectTypes;
+import org.distorted.library.Float1D;
 import org.distorted.library.Float2D;
 import org.distorted.library.Float3D;
+import org.distorted.library.Float4D;
+import org.distorted.library.Interpolator1D;
+import org.distorted.library.Interpolator2D;
 
 import android.app.AlertDialog;
 import android.content.Context;
@@ -29,20 +33,17 @@ class CheckRenderer implements GLSurfaceView.Renderer
 {
     private GLSurfaceView mView;
     private DistortedBitmap mSuccess;
-    private Float2D pUp, pDown;
-    private Float3D vUp, vDown;
-    
     private int bmpHeight, bmpWidth;
-    
+
     public static String compilationResult;
     public static String compilationTitle;
-    
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public CheckRenderer(GLSurfaceView view) 
       { 
       mView = view;
-    
+
       Distorted.setMaxVertex(CheckActivity.getMaxV());
       Distorted.setMaxFragment(CheckActivity.getMaxF());
       }
@@ -85,8 +86,8 @@ class CheckRenderer implements GLSurfaceView.Renderer
       {  
       InputStream is = mView.getContext().getResources().openRawResource(R.raw.success);
       Bitmap bitmap;
-        
-      try 
+
+      try
         {
         bitmap = BitmapFactory.decodeStream(is);
         } 
@@ -97,27 +98,51 @@ class CheckRenderer implements GLSurfaceView.Renderer
           is.close();
           } 
         catch(IOException e) { }
-        }  
-      
+        }
+
+      mSuccess = new DistortedBitmap(bitmap, 30);
+
       bmpHeight = bitmap.getHeight();
       bmpWidth  = bitmap.getWidth();
-       
-      pDown = new Float2D(bmpWidth/2,        0);
-      pUp   = new Float2D(bmpWidth/2,bmpHeight);
-      
-      vUp   = new Float3D( 0,+bmpHeight,0);
-      vDown = new Float3D( 0,-bmpHeight,0);
-      
-      mSuccess = new DistortedBitmap(bitmap, 30);  
-      mSuccess.deform(  vUp,   pUp, 2000, 0.0f);
+
+      // Try adding 2 Vertex Effects to the Bitmap.
+      // This will fail if we have set maxVertexEffects to something < 2.
+      //
+      // Even if adding some of the Effects fails, the App will still start - you just won't see
+      // the effects that failed to add.
+      Float2D pDown   = new Float2D(bmpWidth/2,   0);
+      Float3D vDown   = new Float3D( 0,-bmpHeight,0);
+      Float4D mRegion = new Float4D( 0, 0, 40 ,40 );
+
+      Interpolator2D mPoint = new Interpolator2D();
+      mPoint.setCount(0.0f);
+      mPoint.setDuration(2000);
+      mPoint.add(new Float2D(        0, bmpHeight/2));
+      mPoint.add(new Float2D( bmpWidth, bmpHeight/2));
+
+      mSuccess.swirl( 30, mRegion, mPoint );
       mSuccess.deform(vDown, pDown, 2000, 0.0f);
-      
+
+      // Now try adding 1 Fragment Effect. Likewise, will fail if maxFragmentEffects is <1.
+      Float3D color = new Float3D(1,0,0);
+      Interpolator1D inter = new Interpolator1D();
+      inter.setCount(0.0f);
+      inter.setDuration(2000);
+      inter.add(new Float1D(0));
+      inter.add(new Float1D(1));
+
+      mSuccess.chroma(inter, color, null, new Float2D(0,0) );
+
       try
         {
         Distorted.onSurfaceCreated(mView.getContext());
         }
       catch(Exception ex)
         {
+        // We have failed to compile or link shaders - probably too many effects.
+        // (each effect adds a certain number of Uniforms to the shader and there
+        // can only be a limited number of those )
+
         compilationTitle = ex.getClass().getSimpleName();
         compilationResult= ex.getMessage();
       
diff --git a/src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java b/src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
index ad27856..8577673 100644
--- a/src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
+++ b/src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
@@ -169,7 +169,7 @@ public class MovingEffectsSurfaceView extends GLSurfaceView
         {
         MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX);
         MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT);
-        MovingEffectsRenderer.mBackground.swirl(30, dr, di2D, 0, 0.5f);  
+        MovingEffectsRenderer.mBackground.swirl(30, dr, di2D);
         mCurrEffect = EFFECT_SWIRL;
         }
       }
