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/flag/FlagSurfaceView.java
19 19

  
20 20
package org.distorted.examples.flag;
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
import android.view.MotionEvent;
......
33 35
	
34 36
///////////////////////////////////////////////////////////////////////////////////////////////////
35 37
   
36
    public FlagSurfaceView(Context c, AttributeSet attrs)
38
    public FlagSurfaceView(Context context, AttributeSet attrs)
37 39
      {
38
      super(c,attrs);
40
      super(context,attrs);
39 41
    
40 42
      mX = -1;
41 43
      mY = -1;
42 44
      
43 45
      if(!isInEditMode())
44 46
        {
45
        setEGLContextClientVersion(2);
47
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
48
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
49
        android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion());
50
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
46 51
        mRenderer = new FlagRenderer(this);
47 52
        setRenderer(mRenderer);
48 53
        }

Also available in: Unified diff