Project

General

Profile

« Previous | Next » 

Revision 59540ba2

Added by Leszek Koltunski about 7 years ago

Convert (almost) all remaining Apps to the new API which avoids memory leaks with Surfaces.

Remaining problematic Apps: 15. FBO 16. Star Wars (both leak Tree FBOs) 22. SurfaceView (does not work at all after going to background)

View differences:

src/main/java/org/distorted/examples/fbo/FBORenderer.java
53 53
{
54 54
   private GLSurfaceView mView;
55 55
   private DistortedEffects mEffects;
56
   private DistortedTexture mLisaTexture, mGridTexture;
56 57
   private DistortedScreen mScreen;
57 58
   private DistortedNode mRoot;
58 59
   private int lisaHeight, lisaWidth;
......
157 158
      int gridWidth = bitmap2.getWidth();
158 159
      int gridHeight= bitmap2.getHeight();
159 160

  
160
      DistortedTexture lisa = new DistortedTexture(lisaWidth,lisaHeight);
161
      DistortedTexture grid = new DistortedTexture(gridWidth,gridHeight);
162
      lisa.setTexture(bitmap1);
163
      grid.setTexture(bitmap2);
161
      if( mLisaTexture==null ) mLisaTexture = new DistortedTexture(lisaWidth,lisaHeight);
162
      if( mGridTexture==null ) mGridTexture = new DistortedTexture(gridWidth,gridHeight);
163
      mLisaTexture.setTexture(bitmap1);
164
      mGridTexture.setTexture(bitmap2);
164 165
      DistortedEffects gridEffects = new DistortedEffects();
165 166

  
166 167
      mEffects.abortAllEffects();
167 168

  
168
      mRoot = new DistortedNode(lisa, mEffects,new MeshFlat(1,1));
169
      mRoot.attach(grid,gridEffects,new MeshCubes(10,10,false));
169
      mRoot = new DistortedNode(mLisaTexture, mEffects,new MeshFlat(1,1));
170
      mRoot.attach(mGridTexture,gridEffects,new MeshCubes(10,10,false));
170 171

  
171 172
      setDepthPriv();
172 173

  

Also available in: Unified diff