Revision 1f9a52f1
Added by Leszek Koltunski about 7 years ago
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 |
} |
Also available in: Unified diff
Simplify setting up DistortedScreen.