commit 51554e4700774b72e18e97c7cc72ef887dfbf551
Author: leszek <leszek@koltunski.pl>
Date:   Mon Apr 24 22:51:48 2017 +0100

    Convert a few more APPs to the new resolution-independent Matrix Effects.

diff --git a/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java b/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
index 311446a..1633ac4 100644
--- a/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
+++ b/src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
@@ -21,7 +21,6 @@ package org.distorted.examples.aroundtheworld;
 
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.opengl.GLES30;
 import android.opengl.GLSurfaceView;
 
 import org.distorted.examples.R;
@@ -49,7 +48,7 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
    private DistortedTexture mTexture;
    private DistortedScreen mScreen;
    private AroundTheWorldEffectsManager mManager;
-   private int mObjWidth, mObjHeight;
+   private int bmpWidth, bmpHeight;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -84,22 +83,11 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
     
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
       {
-      mEffects.abortEffects(EffectTypes.MATRIX);
+      float qx = (float)width /bmpWidth;
+      float qy = (float)height/bmpHeight;
 
-      if( (float)mObjHeight/mObjWidth > (float)height/width )
-        {
-        int w = (height*mObjWidth)/mObjHeight;
-        float factor = (float)height/mObjHeight;
-        mEffects.move( new Static3D((width-w)/2,0,0) );
-        mEffects.scale(factor);
-        }
-      else
-        {
-        int h = (width*mObjHeight)/mObjWidth;
-        float factor = (float)width/mObjWidth;
-        mEffects.move( new Static3D(0,(height-h)/2,0) );
-        mEffects.scale(factor);
-        }
+      mEffects.abortEffects(EffectTypes.MATRIX);
+      mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
 
       mScreen.resize(width,height);
       }
@@ -124,14 +112,14 @@ class AroundTheWorldRenderer implements GLSurfaceView.Renderer
         catch(IOException e) { }
         }
 
-      mObjWidth = bitmap.getWidth();
-      mObjHeight= bitmap.getHeight();
+      bmpWidth = bitmap.getWidth();
+      bmpHeight= bitmap.getHeight();
 
-      if( mTexture==null ) mTexture = new DistortedTexture(mObjWidth,mObjHeight);
+      if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
       mTexture.setTexture(bitmap);
 
       mScreen.detachAll();
-      mScreen.attach(mTexture, mEffects, new MeshFlat(30,30*mObjHeight/mObjWidth));
+      mScreen.attach(mTexture, mEffects, new MeshFlat(30,30*bmpHeight/bmpWidth));
 
       DistortedEffects.enableEffect(EffectNames.DISTORT);
       DistortedEffects.enableEffect(EffectNames.SINK);
diff --git a/src/main/java/org/distorted/examples/blur/BlurRenderer.java b/src/main/java/org/distorted/examples/blur/BlurRenderer.java
index af63e25..3c1174d 100644
--- a/src/main/java/org/distorted/examples/blur/BlurRenderer.java
+++ b/src/main/java/org/distorted/examples/blur/BlurRenderer.java
@@ -91,70 +91,57 @@ class BlurRenderer implements GLSurfaceView.Renderer
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
-      { 
-      mEffects.abortEffects(EffectTypes.MATRIX);
-      
-      if( (float)bmpHeight/bmpWidth > (float)height/width )
-        {
-        int w = (height*bmpWidth)/bmpHeight;
-        float factor = (float)height/bmpHeight;
-
-        mEffects.move( new Static3D((width-w)/2,0,0) );
-        mEffects.scale(factor);
-        }
-      else
-        {
-        int h = (width*bmpHeight)/bmpWidth;
-        float factor = (float)width/bmpWidth;
-
-        mEffects.move( new Static3D(0,(height-h)/2,0) );
-        mEffects.scale(factor);
-        }
+   public void onSurfaceChanged(GL10 glUnused, int width, int height)
+     {
+     float qx = (float)width /bmpWidth;
+     float qy = (float)height/bmpHeight;
+
+     mEffects.abortEffects(EffectTypes.MATRIX);
+     mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
       
-      mScreen.resize(width, height);
-      }
+     mScreen.resize(width, height);
+     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
-      {
-      InputStream is = mView.getContext().getResources().openRawResource(R.raw.dog);
-      Bitmap bitmap;
+   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
+     {
+     InputStream is = mView.getContext().getResources().openRawResource(R.raw.dog);
+     Bitmap bitmap;
         
-      try 
-        {
-        bitmap = BitmapFactory.decodeStream(is);
-        } 
-      finally 
-        {
-        try 
-          {
-          is.close();
-          } 
-        catch(IOException e) { }
-        }  
+     try
+       {
+       bitmap = BitmapFactory.decodeStream(is);
+       }
+     finally
+       {
+       try
+         {
+         is.close();
+         }
+       catch(IOException e) { }
+       }
       
-      bmpHeight = bitmap.getHeight();
-      bmpWidth  = bitmap.getWidth();
-
-      if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
-      mTexture.setTexture(bitmap);
-
-      mScreen.detachAll();
-      DistortedNode node = new DistortedNode(mTexture,mEffects,mMesh);
-      node.setPostprocessEffects(mPostEffects);
-      mScreen.attach(node);
-
-      DistortedEffects.enableEffect(EffectNames.BLUR);
-
-      try
-        {
-        Distorted.onCreate(mView.getContext());
-        }
-      catch(Exception ex)
-        {
-        android.util.Log.e("Blur", ex.getMessage() );
-        }
-      }
+     bmpHeight = bitmap.getHeight();
+     bmpWidth  = bitmap.getWidth();
+
+     if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
+     mTexture.setTexture(bitmap);
+
+     mScreen.detachAll();
+     DistortedNode node = new DistortedNode(mTexture,mEffects,mMesh);
+     node.setPostprocessEffects(mPostEffects);
+     mScreen.attach(node);
+
+     DistortedEffects.enableEffect(EffectNames.BLUR);
+
+     try
+       {
+       Distorted.onCreate(mView.getContext());
+       }
+     catch(Exception ex)
+       {
+       android.util.Log.e("Blur", ex.getMessage() );
+       }
+     }
 }
diff --git a/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java b/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
index cc6bff7..51ea6f0 100644
--- a/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
+++ b/src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
@@ -21,7 +21,6 @@ package org.distorted.examples.effects3d;
 
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.opengl.GLES30;
 import android.opengl.GLSurfaceView;
 
 import org.distorted.examples.R;
diff --git a/src/main/java/org/distorted/examples/girl/GirlRenderer.java b/src/main/java/org/distorted/examples/girl/GirlRenderer.java
index 687dd6b..04838e2 100644
--- a/src/main/java/org/distorted/examples/girl/GirlRenderer.java
+++ b/src/main/java/org/distorted/examples/girl/GirlRenderer.java
@@ -157,57 +157,57 @@ class GirlRenderer implements GLSurfaceView.Renderer
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
-      { 
-      float qx = (float)width /bmpWidth;
-      float qy = (float)height/bmpHeight;
+   public void onSurfaceChanged(GL10 glUnused, int width, int height)
+     {
+     float qx = (float)width /bmpWidth;
+     float qy = (float)height/bmpHeight;
 
-      mEffects.abortEffects(EffectTypes.MATRIX);
-      mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
+     mEffects.abortEffects(EffectTypes.MATRIX);
+     mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
       
-      mScreen.resize(width, height);
-      }
+     mScreen.resize(width, height);
+     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
-      {
-      InputStream is = mView.getContext().getResources().openRawResource(R.raw.girl);
-      Bitmap bitmap;
+   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
+     {
+     InputStream is = mView.getContext().getResources().openRawResource(R.raw.girl);
+     Bitmap bitmap;
         
-      try 
-        {
-        bitmap = BitmapFactory.decodeStream(is);
-        } 
-      finally 
-        {
-        try 
-          {
-          is.close();
-          } 
-        catch(IOException e) { }
-        }  
+     try
+       {
+       bitmap = BitmapFactory.decodeStream(is);
+       }
+     finally
+       {
+       try
+         {
+         is.close();
+         }
+       catch(IOException e) { }
+       }
       
-      bmpHeight = bitmap.getHeight();
-      bmpWidth  = bitmap.getWidth();
-
-      if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
-      mTexture.setTexture(bitmap);
-
-      mScreen.detachAll();
-      mScreen.attach(mTexture,mEffects,new MeshFlat(30,30*bmpHeight/bmpWidth));
-
-      DistortedEffects.enableEffect(EffectNames.DISTORT);
-      DistortedEffects.enableEffect(EffectNames.SINK);
-      DistortedEffects.enableEffect(EffectNames.SWIRL);
-
-      try
-        {
-        Distorted.onCreate(mView.getContext());
-        }
-      catch(Exception ex)
-        {
-        android.util.Log.e("Renderer", ex.getMessage() );
-        }
-      }
+     bmpHeight = bitmap.getHeight();
+     bmpWidth  = bitmap.getWidth();
+
+     if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
+     mTexture.setTexture(bitmap);
+
+     mScreen.detachAll();
+     mScreen.attach(mTexture,mEffects,new MeshFlat(30,30*bmpHeight/bmpWidth));
+
+     DistortedEffects.enableEffect(EffectNames.DISTORT);
+     DistortedEffects.enableEffect(EffectNames.SINK);
+     DistortedEffects.enableEffect(EffectNames.SWIRL);
+
+     try
+       {
+       Distorted.onCreate(mView.getContext());
+       }
+     catch(Exception ex)
+       {
+       android.util.Log.e("Renderer", ex.getMessage() );
+       }
+     }
 }
diff --git a/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java b/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
index 53fe349..8375f23 100644
--- a/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
+++ b/src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
@@ -56,7 +56,7 @@ class OlimpicRenderer implements GLSurfaceView.Renderer
    private DistortedTexture mLeaf;
    private DistortedScreen mScreen;
    private MeshFlat mMesh;
-   private int mScreenW, mScreenH;
+   private int mRootW, mRootH;
    private int mPrevRendered, mCurrRendered;
 
    private DistortedNode[] mCircleNode = new DistortedNode[NUM_CIRCLES];
@@ -95,27 +95,30 @@ class OlimpicRenderer implements GLSurfaceView.Renderer
       mMesh = new MeshFlat(1,1);
       DistortedEffects effects = new DistortedEffects();
 
-      mScreenW = 9*LEAF_SIZE;
-      mScreenH = 9*LEAF_SIZE;
-      mRoot = new DistortedNode(new DistortedTexture(mScreenW,mScreenH), effects, mMesh);
+      mRootW = 9*LEAF_SIZE;
+      mRootH = 9*LEAF_SIZE;
+      mRoot = new DistortedNode(new DistortedTexture(mRootW,mRootH), effects, mMesh);
      
       Dynamic1D rot = new Dynamic1D(5000,0.0f);
       rot.setMode(Dynamic1D.MODE_JUMP);
       rot.add(new Static1D(  0));
       rot.add(new Static1D(360));
 
-      int[] colors    = new int[] {0,0,1,  0,0,0,  1,0,0,  1,1,0,  0,1,0}; // blue, black, red, yellow, green  
-      int[] positions = new int[] {0,2*LEAF_SIZE,  3*LEAF_SIZE,2*LEAF_SIZE,  6*LEAF_SIZE,2*LEAF_SIZE,  3*LEAF_SIZE/2,9*LEAF_SIZE/2,  9*LEAF_SIZE/2,9*LEAF_SIZE/2};
+      int[]   colors    = new int[] {0,0,1,  0,0,0,  1,0,0,  1,1,0,  0,1,0}; // blue, black, red, yellow, green
+      float[] positions = new float[] { -0.333f, -0.12f,    0.0f,-0.12f,    +0.333f,-0.12f,
+                                               -0.166f,+0.166f,     +0.166f,+0.166f };
       
-      Static3D center = new Static3D(3*LEAF_SIZE/2, 3*LEAF_SIZE/2, 0);
+      Static3D center = new Static3D(0,0,0);
       Static3D axis   = new Static3D(0,0,1);
-      Static3D moveVector = new Static3D(0,LEAF_SIZE,0);
+      Static3D move   = new Static3D(-0.33f,0.0f,0.0f);
+      Static3D scale  = new Static3D(0.333f,0.333f,0.333f);
 
       for(int j=0; j<NUM_LEAVES; j++)
         {
         mEffects[j] = new DistortedEffects();
-        mEffects[j].rotate( new Static1D(j*(360/NUM_LEAVES)), axis, center );
-        mEffects[j].move(moveVector);
+        mEffects[j].rotate( new Static1D(j*(360/NUM_LEAVES)), axis, center);
+        mEffects[j].move(move);
+        mEffects[j].scale(scale);
         }
 
       for(int i=0; i<NUM_CIRCLES; i++)
@@ -123,6 +126,7 @@ class OlimpicRenderer implements GLSurfaceView.Renderer
         effects = new DistortedEffects();
         effects.move( new Static3D(positions[2*i], positions[2*i+1], 0) );
         effects.rotate( rot, axis, center );
+        effects.scale( scale );
         effects.chroma( new Static1D(0.5f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2]) );
 
         mCircleNode[i] = new DistortedNode( surface, effects, mMesh);
@@ -137,88 +141,72 @@ class OlimpicRenderer implements GLSurfaceView.Renderer
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
    
-    public void onDrawFrame(GL10 glUnused) 
-      {
-      mCurrRendered = mScreen.render(System.currentTimeMillis());
+   public void onDrawFrame(GL10 glUnused)
+     {
+     mCurrRendered = mScreen.render(System.currentTimeMillis());
 
-      if( mCurrRendered!=mPrevRendered )
-        {
-        mPrevRendered = mCurrRendered;
+     if( mCurrRendered!=mPrevRendered )
+       {
+       mPrevRendered = mCurrRendered;
 
-        final OlimpicActivity act = (OlimpicActivity)mView.getContext();
+       final OlimpicActivity act = (OlimpicActivity)mView.getContext();
 
-        act.runOnUiThread(new Runnable()
+       act.runOnUiThread(new Runnable()
           {
           public void run()
             {
-            act.setText("rendered: "+mCurrRendered+" objects");
-            }
+           act.setText("rendered: "+mCurrRendered+" objects");
+           }
           });
-        }
-      }
+       }
+     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
-      {
-      DistortedEffects effects = mRoot.getEffects();
+   public void onSurfaceChanged(GL10 glUnused, int width, int height)
+     {
+     DistortedEffects effects = mRoot.getEffects();
 
-      effects.abortEffects(EffectTypes.MATRIX);
-      
-      if( (float)mScreenH/mScreenW > (float)height/width )
-        {
-        int w = (height*mScreenW)/mScreenH;
-        float factor = (float)height/mScreenH;
+     float qx = (float)width /mRootW;
+     float qy = (float)height/mRootH;
 
-        effects.move( new Static3D((width-w)/2 ,0, 0) );
-        effects.scale( factor );
-        }
-      else
-        {
-        int h = (width*mScreenH)/mScreenW;
-        float factor = (float)width/mScreenW;
+     effects.abortEffects(EffectTypes.MATRIX);
+     effects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
 
-        effects.move( new Static3D(0,(height-h)/2,0) );
-        effects.scale( factor );
-        }
-      
-      mScreen.resize(width, height);
-      }
+     mScreen.resize(width, height);
+     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
-      {
-      InputStream is = mView.getContext().getResources().openRawResource(R.raw.leaf);
-      Bitmap leaf;
+   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
+     {
+     InputStream is = mView.getContext().getResources().openRawResource(R.raw.leaf);
+     Bitmap leaf;
       
-      try 
-        {
-        leaf = BitmapFactory.decodeStream(is);
-        } 
-      finally 
-        {
-        try 
-          {
-          is.close();
-          } 
-        catch(IOException e) { }
-        }  
+     try
+       {
+       leaf = BitmapFactory.decodeStream(is);
+       }
+     finally
+       {
+       try
+         {
+         is.close();
+         }
+       catch(IOException e) { }
+       }
       
-      mLeaf.setTexture(leaf);
+     mLeaf.setTexture(leaf);
 
-      DistortedEffects.enableEffect(EffectNames.CHROMA);
+     DistortedEffects.enableEffect(EffectNames.CHROMA);
 
-      try
-        {
-        Distorted.onCreate(mView.getContext());
-        }
-      catch(Exception ex)
-        {
-        android.util.Log.e("Olympic", ex.getMessage() );
-        }
-      }
- 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
+     try
+       {
+       Distorted.onCreate(mView.getContext());
+       }
+     catch(Exception ex)
+       {
+       android.util.Log.e("Olympic", ex.getMessage() );
+       }
+     }
 }
diff --git a/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java b/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
index 843cd2b..481e50d 100644
--- a/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
+++ b/src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
@@ -209,24 +209,11 @@ class RenderThread extends Thread
     {
     Log.d(TAG, "surfaceChanged " + width + "x" + height);
 
-    mEffects.abortEffects(EffectTypes.MATRIX);
-
-    if( (float)bmpHeight/bmpWidth > (float)height/width )
-      {
-      int w = (height*bmpWidth)/bmpHeight;
-      float factor = (float)height/bmpHeight;
-
-      mEffects.move( new Static3D((width-w)/2,0,0) );
-      mEffects.scale( factor );
-      }
-    else
-      {
-      int h = (width*bmpHeight)/bmpWidth;
-      float factor = (float)width/bmpWidth;
+    float qx = (float)width /bmpWidth;
+    float qy = (float)height/bmpHeight;
 
-      mEffects.move( new Static3D(0,(height-h)/2,0) );
-      mEffects.scale( factor );
-      }
+    mEffects.abortEffects(EffectTypes.MATRIX);
+    mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
 
     mScreen.resize(width, height);
     }
diff --git a/src/main/java/org/distorted/examples/save/SaveRenderer.java b/src/main/java/org/distorted/examples/save/SaveRenderer.java
index f798bd9..880c741 100644
--- a/src/main/java/org/distorted/examples/save/SaveRenderer.java
+++ b/src/main/java/org/distorted/examples/save/SaveRenderer.java
@@ -187,24 +187,11 @@ class SaveRenderer implements GLSurfaceView.Renderer
 
   private void applyMatrixEffects(int width, int height)
     {
-    mEffects.abortEffects(EffectTypes.MATRIX);
-
-    if( (float)bmpHeight/bmpWidth > (float)height/width )
-      {
-      int w = (height*bmpWidth)/bmpHeight;
-      float factor = (float)height/bmpHeight;
-
-      mEffects.move( new Static3D((width-w)/2,0,0) );
-      mEffects.scale(factor);
-      }
-    else
-      {
-      int h = (width*bmpHeight)/bmpWidth;
-      float factor = (float)width/bmpWidth;
+    float qx = (float)width /bmpWidth;
+    float qy = (float)height/bmpHeight;
 
-      mEffects.move( new Static3D(0,(height-h)/2,0) );
-      mEffects.scale(factor);
-      }
+    mEffects.abortEffects(EffectTypes.MATRIX);
+    mEffects.scale(  qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) );
 
     mEffects.scale(mScaleDyn);
     }
diff --git a/src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java b/src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
index e8ad3c0..22bb859 100644
--- a/src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
+++ b/src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
@@ -404,25 +404,26 @@ class StarWarsRenderer implements GLSurfaceView.Renderer, EffectListener
         int crawlH = mCrawlTexture.getHeight();
         int screenW= mScreen.getWidth();
         int screenH= mScreen.getHeight();
+        int backW  = mCrawlBackgroundTexture.getWidth();
         int backH  = mCrawlBackgroundTexture.getHeight();
-        float scale= (float)screenW/crawlW;
+        float scale= ((float)backW/backH)*((float)crawlH/crawlW);
 
-        //mCrawlBackgroundEffects.move( new Static3D(0,screenH-backH,0) );
+        mCrawlBackgroundEffects.move( new Static3D(0, -((float)backH/screenH-1.0f)/2 ,0) );
         mCrawlBackgroundEffects.rotate( new Static1D(CRAWL_ANGLE), new Static3D(1,0,0), new Static3D(0.5f,1.0f,0.0f) );
         mCrawlBackgroundEffects.scale( new Static3D(1.0f, (float)backH/screenH,1.0f) );
 
         final int transpDist = 5;
         Static4D region = new Static4D(screenW/2,(1-transpDist)*backH,transpDist*backH,transpDist*backH);
-        //mCrawlBackgroundEffects.alpha(new Static1D(1-transpDist*0.6f), region, true);
+        mCrawlBackgroundEffects.alpha(new Static1D(1-transpDist*0.6f), region, true);
 
         Dynamic3D di = new Dynamic3D(70000,0.5f);
-        di.add(new Static3D(screenW/2,+backH       , 0));
-        di.add(new Static3D(screenW/2,-scale*crawlH, 0));
+        di.add(new Static3D(0,         0,0));
+        di.add(new Static3D(0,-(1+scale),0));
+
+        mCrawlEffects.move(di);
+        mCrawlEffects.move ( new Static3D(0, (1+scale)/2,0) );
+        mCrawlEffects.scale( new Static3D(1,    scale   ,1) );
 
-        //mCrawlEffects.move(di);
-        //mCrawlEffects.scale( new Static3D(scale,scale,scale) );
-        //mCrawlEffects.move( new Static3D(-crawlW/2,0,0) );
-        
         mBackground = mScreen.attach(mCrawlBackgroundTexture, mCrawlBackgroundEffects,mQuad);
         mBackground.attach(mCrawlTexture, mCrawlEffects,mQuad);
         mBackground.glDisable(GLES30.GL_DEPTH_TEST);
