Revision 41a81a14
Added by Leszek Koltunski over 7 years ago
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; |
|
22 | 23 |
import android.content.Context; |
24 |
import android.content.pm.ConfigurationInfo; |
|
23 | 25 |
import android.opengl.GLSurfaceView; |
24 | 26 |
import android.view.MotionEvent; |
25 | 27 |
import android.util.AttributeSet; |
... | ... | |
49 | 51 |
|
50 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
51 | 53 |
|
52 |
public EffectQueueSurfaceView(Context c, AttributeSet attrs) |
|
54 |
public EffectQueueSurfaceView(Context context, AttributeSet attrs)
|
|
53 | 55 |
{ |
54 |
super(c, attrs); |
|
56 |
super(context, attrs);
|
|
55 | 57 |
|
56 | 58 |
int duration = 10000; |
57 | 59 |
float count = 1.0f; |
... | ... | |
85 | 87 |
{ |
86 | 88 |
setFocusable(true); |
87 | 89 |
setFocusableInTouchMode(true); |
88 |
setEGLContextClientVersion(2); |
|
90 |
final ActivityManager activityManager = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
|
91 |
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); |
|
92 |
android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion()); |
|
93 |
setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 ); |
|
89 | 94 |
|
90 | 95 |
mRenderer = new EffectQueueRenderer(this); |
91 | 96 |
setRenderer(mRenderer); |
Also available in: Unified diff
Try using OpenGL ES 3.0 everywhere (but if device does not support it, try creating 2.0 context - this is important because of the emulator!)