Revision e4330c89
Added by Leszek Koltunski almost 7 years ago
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; |
|
22 | 23 |
import android.content.Context; |
24 |
import android.content.pm.ConfigurationInfo; |
|
23 | 25 |
import android.graphics.Canvas; |
24 | 26 |
import android.graphics.Paint; |
25 | 27 |
import android.graphics.Paint.Style; |
... | ... | |
93 | 95 |
mRegionVertex = new Static4D(0,0,0,0); |
94 | 96 |
mDistort = new Static3D(0,0,0); |
95 | 97 |
|
96 |
mRenderer = new MovingEffectsRenderer(this); |
|
97 |
|
|
98 | 98 |
if(!isInEditMode()) |
99 | 99 |
{ |
100 |
mRenderer = new MovingEffectsRenderer(this); |
|
101 |
|
|
100 | 102 |
setFocusable(true); |
101 | 103 |
setFocusableInTouchMode(true); |
104 |
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
|
105 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
|
106 |
setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 ); |
|
102 | 107 |
setRenderer(mRenderer); |
103 |
} |
|
104 | 108 |
|
105 |
mEffectDistort = new VertexEffectDistort( mDistort , mCenterVertex, mRegionVertex); |
|
106 |
mEffectSink = new VertexEffectSink(new Static1D(10), mCenterVertex, mRegionVertex); |
|
107 |
mEffectSwirl = new VertexEffectSwirl( new Static1D(30), mCenterVertex, mRegionVertex); |
|
108 |
mEffectAlpha = new FragmentEffectAlpha(new Static1D(0.5f), mRegionFragment, true); |
|
109 |
mEffectChroma = new FragmentEffectChroma(new Static1D(0.5f), new Static3D(1,0,0), mRegionFragment, true); |
|
109 |
mEffectDistort = new VertexEffectDistort( mDistort , mCenterVertex, mRegionVertex); |
|
110 |
mEffectSink = new VertexEffectSink(new Static1D(10), mCenterVertex, mRegionVertex); |
|
111 |
mEffectSwirl = new VertexEffectSwirl( new Static1D(30), mCenterVertex, mRegionVertex); |
|
112 |
mEffectAlpha = new FragmentEffectAlpha(new Static1D(0.5f), mRegionFragment, true); |
|
113 |
mEffectChroma = new FragmentEffectChroma(new Static1D(0.5f), new Static3D(1,0,0), mRegionFragment, true); |
|
114 |
} |
|
110 | 115 |
} |
111 | 116 |
|
112 | 117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Change of API: move setting the EGL context back to the APP.