Project

General

Profile

« Previous | Next » 

Revision 1f9a52f1

Added by Leszek Koltunski about 7 years ago

Simplify setting up DistortedScreen.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
62 62
      mManager = new AroundTheWorldEffectsManager();
63 63
      mEffects = new DistortedEffects();
64 64
      mManager.apply(mEffects);
65
      mScreen = new DistortedScreen();
65
      mScreen = new DistortedScreen(mView);
66 66
      mScreen.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
67 67
      }
68 68

  
src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldSurfaceView.java
19 19

  
20 20
package org.distorted.examples.aroundtheworld;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new AroundTheWorldRenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }
src/main/java/org/distorted/examples/bean/BeanRenderer.java
89 89
      mEffects.distort(dLeft , pLeft , rLeft );
90 90
      mEffects.distort(dRight, pRight, rRight);
91 91

  
92
      mScreen = new DistortedScreen();
92
      mScreen = new DistortedScreen(mView);
93 93
      }
94 94

  
95 95
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/bean/BeanSurfaceView.java
19 19

  
20 20
package org.distorted.examples.bean;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26
import android.os.Build;
27 24

  
28 25
///////////////////////////////////////////////////////////////////////////////////////////////////
29 26

  
......
34 31
    public BeanSurfaceView(Context context) 
35 32
      {
36 33
      super(context);
37
      final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
38
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
39
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
40 34
      setRenderer(new BeanRenderer(this));
41 35
      }
42 36
}
src/main/java/org/distorted/examples/blur/BlurRenderer.java
64 64
      mMesh        = new MeshFlat(1,1);
65 65
      mEffects     = new DistortedEffects();
66 66
      mPostEffects = new DistortedEffectsPostprocess();
67
      mScreen      = new DistortedScreen();
67
      mScreen      = new DistortedScreen(mView);
68 68

  
69 69
      mRadiusSta = new Static1D(5);
70 70
      Dynamic1D radiusDyn = new Dynamic1D();
src/main/java/org/distorted/examples/blur/BlurSurfaceView.java
19 19

  
20 20
package org.distorted.examples.blur;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new BlurRenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
78 78

  
79 79
      mEffects.alpha( alphaDyn, alphaRegion, false );
80 80

  
81
      mScreen = new DistortedScreen();
81
      mScreen = new DistortedScreen(mView);
82 82
      }
83 83

  
84 84
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/catanddog/CatAndDogSurfaceView.java
19 19

  
20 20
package org.distorted.examples.catanddog;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
    public CatAndDogSurfaceView(Context context)
34 32
      {
35 33
      super(context);
36
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39 34
      setRenderer(new CatAndDogRenderer(this));
40 35
      }
41 36
}
src/main/java/org/distorted/examples/check/CheckRenderer.java
75 75
      DistortedEffects.setMaxVertex(act.getMaxV());
76 76
      DistortedEffects.setMaxFragment(act.getMaxF());
77 77

  
78
      mScreen = new DistortedScreen();
78
      mScreen = new DistortedScreen(mView);
79 79
      }
80 80

  
81 81
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/check/CheckSurfaceView.java
19 19

  
20 20
package org.distorted.examples.check;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
34 32
    public CheckSurfaceView(Context context, AttributeSet attrs)
35 33
      {
36 34
      super(context, attrs);
37
    
38
      if(!isInEditMode())
39
        {
40
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
41
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
42
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
43
        setRenderer(new CheckRenderer(this));
44
        }
35
      if(!isInEditMode()) setRenderer(new CheckRenderer(this));
45 36
      }
46

  
47 37
}
src/main/java/org/distorted/examples/cubes/CubesRenderer.java
82 82
      mQuatInt1.add(mQuat1);
83 83
      mQuatInt2.add(mQuat2);
84 84

  
85
      mScreen = new DistortedScreen();
85
      mScreen = new DistortedScreen(mView);
86 86
      }
87 87

  
88 88
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/cubes/CubesSurfaceView.java
21 21

  
22 22
import org.distorted.examples.R;
23 23

  
24
import android.app.ActivityManager;
25 24
import android.content.Context;
26
import android.content.pm.ConfigurationInfo;
27 25
import android.opengl.GLSurfaceView;
28 26
import android.util.AttributeSet;
29 27
import android.view.MotionEvent;
......
47 45
      
48 46
      if(!isInEditMode())
49 47
        {
50
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
51
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
52
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
53 48
        mRenderer = new CubesRenderer(this);
54 49
        setRenderer(mRenderer);
55 50
        Toast.makeText(context, R.string.example_rotate_toast , Toast.LENGTH_SHORT).show();
src/main/java/org/distorted/examples/deform/DeformRenderer.java
164 164

  
165 165
      mMovingShearDynamic.add(vShear[0]);
166 166

  
167
      mScreen = new DistortedScreen();
167
      mScreen = new DistortedScreen(mView);
168 168
      }
169 169

  
170 170
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/deform/DeformSurfaceView.java
19 19

  
20 20
package org.distorted.examples.deform;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25
import android.view.MotionEvent;
......
41 39
    
42 40
      if(!isInEditMode())
43 41
        {
44
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
45
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
46
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
47 42
        mRenderer = new DeformRenderer(this);
48 43
        setRenderer(mRenderer);
49 44
        }
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java
77 77
      mEffects[0].sink( new Static1D(8), mPoint, new Static4D(0,0,80,80));  // enlarge the nose
78 78
      mEffects[0].distort(dDistort,mPoint);                                 // keep moving the whole bitmap left and right.
79 79

  
80
      mScreen = new DistortedScreen();
80
      mScreen = new DistortedScreen(mView);
81 81
      mScreen.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
82 82
      }
83 83

  
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsSurfaceView.java
19 19

  
20 20
package org.distorted.examples.differentbitmaps;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
    public DifferentBitmapsSurfaceView(Context context) 
34 32
      {
35 33
      super(context);
36
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39 34
      setRenderer(new DifferentBitmapsRenderer(this));
40 35
      }
41 36
}
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
94 94

  
95 95
      mEffects[2].chroma(chromaDyn, new Static3D(0,1,0) );
96 96

  
97
      mScreen = new DistortedScreen();
97
      mScreen = new DistortedScreen(mView);
98 98
      }
99 99

  
100 100
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsSurfaceView.java
19 19

  
20 20
package org.distorted.examples.differenteffects;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
    public DifferentEffectsSurfaceView(Context context) 
34 32
      {
35 33
      super(context);
36
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39 34
      setRenderer(new DifferentEffectsRenderer(this));
40 35
      }
41 36
}
src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java
62 62
     mView    = v;
63 63
     mMesh    = new MeshFlat(1,1);
64 64
     mEffects = new DistortedEffects();
65
     mScreen  = new DistortedScreen();
65
     mScreen  = new DistortedScreen(mView);
66 66
     }
67 67

  
68 68
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/dynamic/DynamicSurfaceView.java
19 19

  
20 20
package org.distorted.examples.dynamic;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.view.MotionEvent;
27 25
import android.util.AttributeSet;
......
110 108
        {
111 109
        setFocusable(true);
112 110
        setFocusableInTouchMode(true);
113
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
114
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
115
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
116 111
        DynamicRenderer mRenderer = new DynamicRenderer(this);
117 112
        setRenderer(mRenderer);
118 113
        }
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
76 76

  
77 77
    mEffects.registerForMessages(this);
78 78

  
79
    mScreen = new DistortedScreen();
79
    mScreen = new DistortedScreen(mView);
80 80
    }
81 81

  
82 82
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/effectqueue/EffectQueueSurfaceView.java
19 19

  
20 20
package org.distorted.examples.effectqueue;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.view.MotionEvent;
27 25
import android.util.AttributeSet;
......
87 85
      {
88 86
      setFocusable(true);
89 87
      setFocusableInTouchMode(true);
90
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
91
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
92
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
93 88

  
94 89
      mRenderer = new EffectQueueRenderer(this);
95 90
      setRenderer(mRenderer);
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
119 119
      mCenterNode = new DistortedNode(mCenterTexture, mCenterEffects, quad);
120 120
      mRegionNode = new DistortedNode(mRegionTexture, mRegionEffects, quad);
121 121

  
122
      mScreen = new DistortedScreen();
122
      mScreen = new DistortedScreen(mView);
123 123
      mScreen.setProjection(FOV, NEAR);
124 124
      mScreen.attach(mBackgroundTexture, mBackgroundEffects, quad );
125 125
      mScreen.attach(mObjectTexture    , mObjectEffects    , meshO);
src/main/java/org/distorted/examples/effects3d/Effects3DSurfaceView.java
19 19

  
20 20
package org.distorted.examples.effects3d;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25
import android.view.MotionEvent;
......
41 39
      
42 40
    if(!isInEditMode())
43 41
      {
44
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
45
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
46
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
47 42
      mRenderer = new Effects3DRenderer(this);
48 43
      setRenderer(mRenderer);
49 44
      }
src/main/java/org/distorted/examples/fbo/FBORenderer.java
68 68
      mView   = v;
69 69
      mDepth  = true;
70 70
      mEffects= new DistortedEffects();
71
      mScreen = new DistortedScreen();
71
      mScreen = new DistortedScreen(mView);
72 72
      }
73 73

  
74 74
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/fbo/FBOSurfaceView.java
19 19

  
20 20
package org.distorted.examples.fbo;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new FBORenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }
src/main/java/org/distorted/examples/flag/FlagRenderer.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;
......
95 94

  
96 95
      mEffects.wave(mWaveDyn, waveCenter, waveRegion);
97 96

  
98
      mScreen = new DistortedScreen();
97
      mScreen = new DistortedScreen(mView);
99 98
      mScreen.attach(mTexture,mEffects, new MeshCubes(50,30,false) );
100 99
      }
101 100

  
src/main/java/org/distorted/examples/flag/FlagSurfaceView.java
19 19

  
20 20
package org.distorted.examples.flag;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25
import android.view.MotionEvent;
......
44 42
      
45 43
      if(!isInEditMode())
46 44
        {
47
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
48
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
49
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
50 45
        mRenderer = new FlagRenderer(this);
51 46
        setRenderer(mRenderer);
52 47
        }
src/main/java/org/distorted/examples/girl/GirlRenderer.java
121 121

  
122 122
      mEffects.swirl(diHips, pHips, HipsRegion );
123 123

  
124
      mScreen = new DistortedScreen();
124
      mScreen = new DistortedScreen(mView);
125 125
      }
126 126

  
127 127
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/girl/GirlSurfaceView.java
19 19

  
20 20
package org.distorted.examples.girl;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new GirlRenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }
src/main/java/org/distorted/examples/listener/ListenerRenderer.java
67 67
      mView = v;
68 68
      mEffects = new DistortedEffects();
69 69
      mEffects.registerForMessages(this);
70
      mScreen = new DistortedScreen();
70
      mScreen = new DistortedScreen(mView);
71 71
      mRnd = new Random(0);
72 72
      }
73 73

  
src/main/java/org/distorted/examples/listener/ListenerSurfaceView.java
19 19

  
20 20
package org.distorted.examples.listener;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
    public ListenerSurfaceView(Context context) 
34 32
      {
35 33
      super(context);
36
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39 34
      setRenderer(new ListenerRenderer(this));
40 35
      }
41 36
}
src/main/java/org/distorted/examples/matrix3d/Matrix3DRenderer.java
46 46
      mView = v;
47 47
      Matrix3DActivity act = (Matrix3DActivity)v.getContext();
48 48
      mTexture= act.getTexture();
49
      mScreen = new DistortedScreen();
49
      mScreen = new DistortedScreen(mView);
50 50
      mScreen.attach(mTexture,act.getEffects(),act.getMesh());
51 51
      mScreen.setProjection(60.0f,0.1f);
52 52
      }
src/main/java/org/distorted/examples/matrix3d/Matrix3DSurfaceView.java
19 19

  
20 20
package org.distorted.examples.matrix3d;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37
      
40 38
    if(!isInEditMode())
41 39
      {
42
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
      mRenderer = new Matrix3DRenderer(this);
46 41
      setRenderer(mRenderer);
47 42
      }
......
53 48
    {
54 49
    return mRenderer;
55 50
    }
56

  
57 51
  }
58 52

  
src/main/java/org/distorted/examples/mirror/MirrorRenderer.java
72 72
      { 
73 73
      mView    = view;
74 74
      mQuad    = new MeshFlat(1,1);
75
      mScreen  = new DistortedScreen();
75
      mScreen  = new DistortedScreen(mView);
76 76

  
77 77
      mEffectsMirror    = new DistortedEffects();
78 78
      mEffectsHead      = new DistortedEffects();
src/main/java/org/distorted/examples/mirror/MirrorSurfaceView.java
19 19

  
20 20
package org.distorted.examples.mirror;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new MirrorRenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }
48 43
      }
44

  
49 45
///////////////////////////////////////////////////////////////////////////////////////////////////
50 46

  
51 47
    public MirrorRenderer getRenderer()
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java
74 74
      mEffects.distort( dLeft, pLeft , rLeft );
75 75
      mEffects.distort(dRight, pRight, rRight);
76 76

  
77
      mScreen = new DistortedScreen();
77
      mScreen = new DistortedScreen(mView);
78 78
      }
79 79

  
80 80
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/monalisa/MonaLisaSurfaceView.java
19 19

  
20 20
package org.distorted.examples.monalisa;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
    public MonaLisaSurfaceView(Context context) 
34 32
      {
35 33
      super(context);
36
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39 34
      setRenderer(new MonaLisaRenderer(this));
40 35
      }
41 36
}
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
62 62

  
63 63
     mView   = v;
64 64
     mEffects= new DistortedEffects();
65
     mScreen = new DistortedScreen();
65
     mScreen = new DistortedScreen(mView);
66 66
     mRefresh= true;
67 67
     }
68 68

  
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
19 19

  
20 20
package org.distorted.examples.movingeffects;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.graphics.Canvas;
26 24
import android.graphics.Paint;
27 25
import android.graphics.Paint.Style;
......
88 86
        {
89 87
        setFocusable(true);
90 88
        setFocusableInTouchMode(true);
91
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
92
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
93
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
94 89
        setRenderer(mRenderer);
95 90
        }
96 91
      }
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
162 162
      mQuatInt1.add(mQuat1);
163 163
      mQuatInt2.add(mQuat2);
164 164

  
165
      mScreen = new DistortedScreen();
165
      mScreen = new DistortedScreen(mView);
166 166

  
167 167
      for(int i=0; i<NUM_OBJECTS; i++)
168 168
        {
src/main/java/org/distorted/examples/multiblur/MultiblurSurfaceView.java
19 19

  
20 20
package org.distorted.examples.multiblur;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25
import android.view.MotionEvent;
......
47 45
      
48 46
      if(!isInEditMode())
49 47
        {
50
        final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
51
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
52
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
53 48
        mRenderer = new MultiblurRenderer(this);
54 49
        setRenderer(mRenderer);
55 50
        Toast.makeText(context, R.string.example_rotate_toast , Toast.LENGTH_SHORT).show();
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
131 131
        for(int j=0; j<NUM_LEAVES; j++) mCircleNode[i].attach(mLeaf, mEffects[j], mMesh);
132 132
        }
133 133

  
134
      mScreen = new DistortedScreen();
134
      mScreen = new DistortedScreen(mView);
135 135
      mScreen.attach(mRoot);
136 136
      }
137 137

  
src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java
19 19

  
20 20
package org.distorted.examples.olimpic;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45

  
46 40
        mRenderer = new OlimpicRenderer(this);
47 41
        setRenderer(mRenderer);
48 42
        }
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
97 97
    mEffects.distort( dLeft, pLeft , rLeft );
98 98
    mEffects.distort(dRight, pRight, rRight);
99 99

  
100
    mScreen = new DistortedScreen();
100
    mScreen = new DistortedScreen(null);
101 101
    }
102 102

  
103 103
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
54 54
      { 
55 55
      mView   = view;
56 56
      mEffects= new DistortedEffects();
57
      mScreen = new DistortedScreen();
57
      mScreen = new DistortedScreen(mView);
58 58
      }
59 59

  
60 60
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/projection/ProjectionSurfaceView.java
19 19

  
20 20
package org.distorted.examples.projection;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37
    
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new ProjectionRenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }
src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java
86 86
    mRot.setDuration(8000);
87 87
    mRot.setMode(Dynamic.MODE_LOOP);
88 88

  
89
    mScreen = new DistortedScreen();
89
    mScreen = new DistortedScreen(mView);
90 90
    mScreen.attach(mTexture,mEffects,mMesh);
91 91
    }
92 92

  
src/main/java/org/distorted/examples/quaternion/QuaternionSurfaceView.java
19 19

  
20 20
package org.distorted.examples.quaternion;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
31 29
  public QuaternionSurfaceView(Context context)
32 30
    {
33 31
    super(context);
34
    final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
35
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
36
    setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
37 32
    setRenderer(new QuaternionRenderer(this));
38 33
    }
39 34
  }
src/main/java/org/distorted/examples/save/SaveRenderer.java
98 98
    mEffects.sink( diSink, pLeft , sinkRegion);
99 99
    mEffects.sink( diSink, pRight, sinkRegion);
100 100

  
101
    mScreen = new DistortedScreen();
101
    mScreen = new DistortedScreen(mView);
102 102
    }
103 103

  
104 104
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/save/SaveSurfaceView.java
19 19

  
20 20
package org.distorted.examples.save;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
    if(!isInEditMode())
41 39
      {
42
      final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
      mRenderer = new SaveRenderer(this);
46 41
      setRenderer(mRenderer);
47 42
      }
src/main/java/org/distorted/examples/sink/SinkRenderer.java
66 66
    mEffects = new DistortedEffects();
67 67
    mEffects.sink( sink, new Static3D(297, 320, 0), null);
68 68

  
69
    mScreen = new DistortedScreen();
69
    mScreen = new DistortedScreen(mView);
70 70
    }
71 71

  
72 72
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/sink/SinkSurfaceView.java
19 19

  
20 20
package org.distorted.examples.sink;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
31 29
  public SinkSurfaceView(Context context) 
32 30
    {
33 31
    super(context);
34
    final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
35
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
36
    setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
37 32
    setRenderer(new SinkRenderer(this));
38 33
    }
39 34
  }
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
137 137
        mStarEffects[i] = new DistortedEffects(mStarEffects[0], Distorted.CLONE_VERTEX);
138 138
      }
139 139

  
140
    mScreen = new DistortedScreen();
140
    mScreen = new DistortedScreen(mView);
141 141
    mScreen.setProjection(FOV_ANGLE, 0.02f);
142 142
    }
143 143

  
src/main/java/org/distorted/examples/starwars/StarWarsSurfaceView.java
19 19

  
20 20
package org.distorted.examples.starwars;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
  public StarWarsSurfaceView(Context context) 
34 32
    {
35 33
    super(context);
36
    final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
    setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39 34
    mRenderer = new StarWarsRenderer(this);
40 35
    setRenderer(mRenderer);
41 36
    }
src/main/java/org/distorted/examples/stencil/StencilRenderer.java
89 89
      cube2Node.glStencilMask(0x00);                                            // Don't write anything to stencil buffer
90 90
      cube2Node.glDepthMask(true);                                              // Write to depth buffer
91 91

  
92
      mScreen = new DistortedScreen();
92
      mScreen = new DistortedScreen(mView);
93 93
      mScreen.attach(cube1Node);
94 94
      mScreen.attach(floorNode);
95 95
      mScreen.attach(cube2Node);
96 96
      mScreen.glClearColor(1.0f,1.0f,1.0f,1.0f);
97

  
98
      mView.setEGLConfigChooser(5,6,5,0,16,8);       // Screen: 16 bit depth, 8 bit STENCIL
97 99
      }
98 100

  
99 101
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/stencil/StencilSurfaceView.java
19 19

  
20 20
package org.distorted.examples.stencil;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24

  
27 25
///////////////////////////////////////////////////////////////////////////////////////////////////
......
33 31
    public StencilSurfaceView(Context context)
34 32
      {
35 33
      super(context);
36
      final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
37
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
38
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
39
      setEGLConfigChooser(5,6,5,0,16,8);       // 16 bit depth, 8 bit STENCIL
40 34
      setRenderer(new StencilRenderer(this));
41 35
      }
42 36
}
src/main/java/org/distorted/examples/wind/WindRenderer.java
61 61
      mEffects = new DistortedEffects();
62 62
      mTexture = new DistortedTexture(50,30);
63 63
      mManager = new WindEffectsManager(mTexture);
64
      mScreen  = new DistortedScreen();
64
      mScreen  = new DistortedScreen(mView);
65 65

  
66 66
      mScreen.attach(mTexture,mEffects,new MeshCubes(50,30,false));
67 67

  
src/main/java/org/distorted/examples/wind/WindSurfaceView.java
19 19

  
20 20
package org.distorted.examples.wind;
21 21

  
22
import android.app.ActivityManager;
23 22
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
25 23
import android.opengl.GLSurfaceView;
26 24
import android.util.AttributeSet;
27 25

  
......
39 37

  
40 38
      if(!isInEditMode())
41 39
        {
42
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
43
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
44
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
45 40
        mRenderer = new WindRenderer(this);
46 41
        setRenderer(mRenderer);
47 42
        }

Also available in: Unified diff