Project

General

Profile

« Previous | Next » 

Revision fe59d375

Added by Leszek Koltunski about 7 years ago

Change the the render() API!

THis introduces some regressions with the Effects3D app.

View differences:

src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
24 24

  
25 25
import org.distorted.library.Distorted;
26 26
import org.distorted.library.DistortedEffects;
27
import org.distorted.library.DistortedFramebuffer;
28 27
import org.distorted.library.DistortedScreen;
29 28
import org.distorted.library.MeshFlat;
30 29
import org.distorted.library.DistortedTexture;
......
43 42
class ProjectionRenderer implements GLSurfaceView.Renderer
44 43
{
45 44
   private GLSurfaceView mView;
46
   private DistortedTexture mTexture;
47 45
   private DistortedEffects mEffects;
48 46
   private DistortedScreen mScreen;
49
   private MeshFlat mMesh;
50 47

  
51 48
   private float mF, mX, mY;
52 49
   private int mWidth, mHeight;
......
92 89
   public void onDrawFrame(GL10 glUnused) 
93 90
      {
94 91
      GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
95
      mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
92
      mScreen.render( System.currentTimeMillis() );
96 93
      }
97 94

  
98 95
///////////////////////////////////////////////////////////////////////////////////////////////////
......
106 103
      mEffects.abortAllEffects();
107 104

  
108 105
      Paint paint = new Paint();
109
      mTexture    = new DistortedTexture(width,height);
110
      mMesh = new MeshFlat(50,50*height/width);
106
      DistortedTexture texture= new DistortedTexture(width,height);
107
      MeshFlat mesh = new MeshFlat(50,50*height/width);
111 108
      Bitmap bmp  = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888);
112 109
      Canvas bmpCanvas = new Canvas(bmp);
113 110

  
......
124 121
        bmpCanvas.drawRect(                   0, height*i/NUMLINES -1,  width               ,  height*i/NUMLINES + 1, paint);
125 122
        }
126 123

  
127
      mTexture.setTexture(bmp);
124
      texture.setTexture(bmp);
128 125

  
129 126
      int min = width<height ? width:height;
130 127

  
......
136 133
      mEffects.distort(vector, new Static3D(  width/4, 3*height/4, 0), region);
137 134
      mEffects.distort(vector, new Static3D(3*width/4, 3*height/4, 0), region);
138 135

  
136
      mScreen.detachAll();
137
      mScreen.attach(texture,mEffects,mesh);
139 138
      mScreen.resize(width, height);
140 139
      }
141 140

  

Also available in: Unified diff