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/bean/BeanSurfaceView.java
19 19

  
20 20
package org.distorted.examples.bean;
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.os.Build;
25 27

  
......
32 34
    public BeanSurfaceView(Context context) 
33 35
      {
34 36
      super(context);
35
      setEGLContextClientVersion(2);
37
      final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
38
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
39
      android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion());
40
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
36 41
      setRenderer(new BeanRenderer(this));
37 42
      }
38 43
}

Also available in: Unified diff