commit a7a8f7bd5bc76f46811d1f6880e2f995b39c9a28
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Mar 3 11:22:10 2020 +0000

    Convert Bean to not use the depreciated MeshBase.setStretch() API.

diff --git a/src/main/java/org/distorted/examples/bean/BeanRenderer.java b/src/main/java/org/distorted/examples/bean/BeanRenderer.java
index 1ab9912..22ecbbb 100644
--- a/src/main/java/org/distorted/examples/bean/BeanRenderer.java
+++ b/src/main/java/org/distorted/examples/bean/BeanRenderer.java
@@ -52,22 +52,25 @@ class BeanRenderer implements GLSurfaceView.Renderer
    private DistortedTexture mTexture;
    private MeshRectangles mMesh;
    private Static3D mScale;
+   private float mBmpRatio;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
+// bean bitmap is 366 x 480. Initialize two dynamic Distorts of the left and right brow.
 
    BeanRenderer(GLSurfaceView v)
       {
       mView = v;
      
-      Static3D pointLeft  = new Static3D(-85,  57, 0);
-      Static3D pointRight = new Static3D( 50, 100, 0);
-      Static4D regionLeft = new Static4D( -3, 33, 0, 47);
-      Static4D regionRight= new Static4D(-14, 33, 0, 47);
+      Static3D pointLeft  = new Static3D(-85/366.0f,  57/480.0f, 0);
+      Static3D pointRight = new Static3D( 50/366.0f, 100/480.0f, 0);
+      Static4D regionLeft = new Static4D( -3/366.0f,  33/480.0f, 0, 47/400.0f);
+      Static4D regionRight= new Static4D(-14/366.0f,  33/480.0f, 0, 47/400.0f);
+
       Dynamic3D dynLeft   = new Dynamic3D(2000,0.0f);
       Dynamic3D dynRight  = new Dynamic3D(2000,0.0f);
 
-      Static3D vect1 = new Static3D(  0,  0, 0);
-      Static3D vect2 = new Static3D(-15, 30, 0);
+      Static3D vect1 = new Static3D(         0,         0, 0);
+      Static3D vect2 = new Static3D(-15/366.0f, 30/480.0f, 0);
 
       dynLeft.add(vect1);
       dynLeft.add(vect1);
@@ -104,11 +107,9 @@ class BeanRenderer implements GLSurfaceView.Renderer
     
    public void onSurfaceChanged(GL10 glUnused, int width, int height)
      {
-     float horiRatio = (float)width / mMesh.getStretchX();
-     float vertRatio = (float)height/ mMesh.getStretchY();
-     float factor    = horiRatio > vertRatio ? vertRatio : horiRatio;
+     float min= width>height ? height : width;
 
-     mScale.set( factor,factor,factor );
+     mScale.set( min, min*mBmpRatio, 1 );
      mScreen.resize(width, height);
      }
 
@@ -132,17 +133,13 @@ class BeanRenderer implements GLSurfaceView.Renderer
        catch(IOException e) { }
        }
       
-     int bmpHeight = bitmap.getHeight();
-     int bmpWidth  = bitmap.getWidth();
+     mBmpRatio = (float)bitmap.getHeight()/bitmap.getWidth();
 
      if( mTexture==null ) mTexture = new DistortedTexture();
      mTexture.setTexture(bitmap);
 
-     if( mMesh==null )
-       {
-       mMesh = new MeshRectangles(25,25*bmpHeight/bmpWidth);
-       mMesh.setStretch(bmpWidth,bmpHeight,0);
-       }
+     // we need a denser Mesh lattice this time for the Distorts to look good.
+     if( mMesh==null ) mMesh = new MeshRectangles(25, (int)(25*mBmpRatio));
 
      mScreen.detachAll();
      mScreen.attach(mTexture,mEffects,mMesh);
