Project

General

Profile

« Previous | Next » 

Revision 41a81a14

Added by Leszek Koltunski over 7 years ago

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!)

View differences:

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;
22 23
import android.content.Context;
24
import android.content.pm.ConfigurationInfo;
23 25
import android.opengl.GLSurfaceView;
24 26
import android.util.AttributeSet;
25 27

  
......
29 31
{
30 32
///////////////////////////////////////////////////////////////////////////////////////////////////
31 33
   
32
    public CheckSurfaceView(Context c, AttributeSet attrs) 
34
    public CheckSurfaceView(Context context, AttributeSet attrs)
33 35
      {
34
      super(c, attrs);
36
      super(context, attrs);
35 37
    
36 38
      if(!isInEditMode())
37 39
        {
38
        setEGLContextClientVersion(2);
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 );
39 44
        setRenderer(new CheckRenderer(this));
40 45
        }
41 46
      }
42 47

  
43 48
}
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

  

Also available in: Unified diff