Revision 722c6ed3
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/olimpic/OlimpicSurfaceView.java | ||
---|---|---|
23 | 23 |
import android.content.Context; |
24 | 24 |
import android.content.pm.ConfigurationInfo; |
25 | 25 |
import android.opengl.GLSurfaceView; |
26 |
import android.util.AttributeSet; |
|
26 | 27 |
|
27 | 28 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 | 29 |
|
... | ... | |
30 | 31 |
{ |
31 | 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 33 |
|
33 |
public OlimpicSurfaceView(Context context)
|
|
34 |
public OlimpicSurfaceView(Context context, AttributeSet attrs)
|
|
34 | 35 |
{ |
35 |
super(context); |
|
36 |
final ActivityManager activityManager = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
|
37 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
|
38 |
android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion()); |
|
39 |
setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 ); |
|
40 |
setRenderer(new OlimpicRenderer(this)); |
|
36 |
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 |
android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion()); |
|
43 |
setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 ); |
|
44 |
setRenderer(new OlimpicRenderer(this)); |
|
45 |
} |
|
41 | 46 |
} |
42 | 47 |
} |
43 | 48 |
|
Also available in: Unified diff
Improve Olimpic.