Revision 59540ba2
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
---|---|---|
57 | 57 |
private GLSurfaceView mView; |
58 | 58 |
private DistortedEffects mEffects; |
59 | 59 |
private DistortedFramebuffer mOffscreen; |
60 |
private DistortedTexture mTexture; |
|
60 | 61 |
private DistortedScreen mScreen; |
61 | 62 |
private Static1D s0; |
62 | 63 |
private Dynamic3D mScaleDyn; |
... | ... | |
242 | 243 |
bmpWidth = bitmap.getWidth(); |
243 | 244 |
|
244 | 245 |
MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth); |
245 |
DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight);
|
|
246 |
texture.setTexture(bitmap);
|
|
246 |
if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
|
|
247 |
mTexture.setTexture(bitmap);
|
|
247 | 248 |
|
248 |
mOffscreen = new DistortedFramebuffer( (int)(mScale*bmpWidth) , (int)(mScale*bmpHeight) ); |
|
249 |
if( mOffscreen==null ) mOffscreen = new DistortedFramebuffer( (int)(mScale*bmpWidth) , (int)(mScale*bmpHeight) );
|
|
249 | 250 |
|
250 | 251 |
mOffscreen.detachAll(); |
251 |
mOffscreen.attach(texture,mEffects,mesh);
|
|
252 |
mOffscreen.attach(mTexture,mEffects,mesh);
|
|
252 | 253 |
mScreen.detachAll(); |
253 |
mScreen.attach(texture,mEffects,mesh);
|
|
254 |
mScreen.attach(mTexture,mEffects,mesh);
|
|
254 | 255 |
|
255 | 256 |
DistortedEffects.enableEffect(EffectNames.SINK); |
256 | 257 |
|
Also available in: Unified diff
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)