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/dynamic/DynamicSurfaceView.java
19 19

  
20 20
package org.distorted.examples.dynamic;
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;
......
76 78
      
77 79
///////////////////////////////////////////////////////////////////
78 80
    
79
    public DynamicSurfaceView(Context c, AttributeSet attrs)
81
    public DynamicSurfaceView(Context context, AttributeSet attrs)
80 82
      {
81
      super(c, attrs);
83
      super(context, attrs);
82 84
      
83 85
      mPaint = new Paint();
84 86
      mPaint.setStyle(Style.FILL);
......
108 110
        {
109 111
        setFocusable(true);
110 112
        setFocusableInTouchMode(true);
111
        setEGLContextClientVersion(2);
113
        final ActivityManager activityManager     = (android.app.ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
114
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
115
        android.util.Log.e("View", "Using OpenGL ES "+configurationInfo.getGlEsVersion());
116
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
112 117
        DynamicRenderer mRenderer = new DynamicRenderer(this);
113 118
        setRenderer(mRenderer);
114 119
        }

Also available in: Unified diff