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/mirror/MirrorRenderer.java
21 21

  
22 22
import android.graphics.Bitmap;
23 23
import android.graphics.BitmapFactory;
24
import android.opengl.GLES30;
25 24
import android.opengl.GLSurfaceView;
26 25

  
27 26
import org.distorted.examples.R;
......
127 126
        mScreenW = width;
128 127
        mScreenH = height;
129 128

  
129
        if( mOffScreen1!=null ) mOffScreen1.markForDeletion();
130
        if( mOffScreen2!=null ) mOffScreen2.markForDeletion();
131

  
130 132
        mOffScreen1 = new DistortedFramebuffer(mScreenW,mScreenH);
131 133
        mOffScreen2 = new DistortedFramebuffer( (int)(MIRROR_SCALE*mScreenW), (int)(MIRROR_SCALE*mScreenH) );
132 134

  
......
186 188
      mHeadW   = bitmapH.getWidth();
187 189
      mHeadH   = bitmapH.getHeight();
188 190

  
189
      mTextureMirror = new DistortedTexture(mMirrorW,mMirrorH);
190
      mTextureHead   = new DistortedTexture(mHeadW, mHeadH);
191
      if( mTextureMirror==null ) mTextureMirror = new DistortedTexture(mMirrorW,mMirrorH);
192
      if( mTextureHead  ==null ) mTextureHead   = new DistortedTexture(mHeadW, mHeadH);
191 193

  
192 194
      mTextureMirror.setTexture(bitmapM);
193 195
      mTextureHead.setTexture(bitmapH);

Also available in: Unified diff