commit 18231014bb9bb52b4b0de105ab9ed217206cf9d3
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Mar 3 11:43:24 2020 +0000

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

diff --git a/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java b/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
index c063853..141aebe 100644
--- a/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
+++ b/src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
@@ -22,6 +22,7 @@ package org.distorted.examples.projection;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 
+import org.distorted.library.effect.MatrixEffectScale;
 import org.distorted.library.effect.VertexEffectDeform;
 import org.distorted.library.main.DistortedLibrary;
 import org.distorted.library.main.DistortedEffects;
@@ -47,9 +48,7 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
    private MeshRectangles mMesh;
    private DistortedTexture mTexture;
    private float mF, mNear;
-
-   private Static3D mVector, mPoint1, mPoint2, mPoint3, mPoint4;
-   private Static4D mRegion;
+   private Static3D mScale;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -59,17 +58,23 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
       mEffects= new DistortedEffects();
       mScreen = new DistortedScreen();
 
-      mVector = new Static3D(0,0,0);
-      mPoint1 = new Static3D(0,0,0);
-      mPoint2 = new Static3D(0,0,0);
-      mPoint3 = new Static3D(0,0,0);
-      mPoint4 = new Static3D(0,0,0);
-      mRegion = new Static4D(0,0,0,0);
-
-      mEffects.apply( new VertexEffectDeform(mVector, mPoint1, mRegion) );
-      mEffects.apply( new VertexEffectDeform(mVector, mPoint2, mRegion) );
-      mEffects.apply( new VertexEffectDeform(mVector, mPoint3, mRegion) );
-      mEffects.apply( new VertexEffectDeform(mVector, mPoint4, mRegion) );
+      Static3D point1 = new Static3D(  0.25f,   0.25f, 0);
+      Static3D point2 = new Static3D( -0.25f,   0.25f, 0);
+      Static3D point3 = new Static3D(  0.25f,  -0.25f, 0);
+      Static3D point4 = new Static3D( -0.25f,  -0.25f, 0);
+      Static4D region = new Static4D( 0, 0, 0, 0.25f);
+      Static3D vector = new Static3D( 0, 0, 0.25f);
+
+      mScale = new Static3D(1,1,1);
+
+      mEffects.apply( new MatrixEffectScale(mScale) );
+
+      mEffects.apply( new VertexEffectDeform(vector, point1, region) );
+      mEffects.apply( new VertexEffectDeform(vector, point2, region) );
+      mEffects.apply( new VertexEffectDeform(vector, point3, region) );
+      mEffects.apply( new VertexEffectDeform(vector, point4, region) );
+
+      mTexture= new DistortedTexture();
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -120,27 +125,12 @@ class ProjectionRenderer implements GLSurfaceView.Renderer
         bmpCanvas.drawRect(                 0, height*i/NUMLINES-1, width             , height*i/NUMLINES+1, paint);
         }
 
-      int min = width<height ? width:height;
-
-      mVector.set(0,0,min/4);
-      mRegion.set(0,0,0,min/4);
-
-      mPoint1.set(  width/4,   height/4, 0);
-      mPoint2.set( -width/4,   height/4, 0);
-      mPoint3.set(  width/4,  -height/4, 0);
-      mPoint4.set( -width/4,  -height/4, 0);
+      mScale.set(width,height,width);  // TODO - width in the third scale??
 
-      // Avoid memory leaks: delete old texture if it exists (it might if we
-      // got here after a brief amount of time spent in the background)
-      if( mTexture!=null ) mTexture.markForDeletion();
-
-      mTexture= new DistortedTexture();
       mTexture.setTexture(bmp);
 
-      // likewise with the Mesh
       if( mMesh!=null )  mMesh.markForDeletion();
       mMesh = new MeshRectangles(100,100*height/width);
-      mMesh.setStretch(width,height,0);
 
       mScreen.detachAll();
       mScreen.attach(mTexture,mEffects,mMesh);
