Project

General

Profile

« Previous | Next » 

Revision 4489e68e

Added by Leszek Koltunski almost 4 years ago

Catch possible exceptions setting up the Renderer (possible on very old devices) and display the OpenGL error popup.

View differences:

src/main/java/org/distorted/main/RubikSurfaceView.java
22 22
import android.app.ActivityManager;
23 23
import android.content.Context;
24 24
import android.content.pm.ConfigurationInfo;
25
import android.opengl.GLES30;
25 26
import android.opengl.GLSurfaceView;
26 27
import android.util.AttributeSet;
27 28
import android.util.DisplayMetrics;
......
706 707

  
707 708
        final ActivityManager activityManager= (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
708 709

  
709
        if( activityManager!=null )
710
        try
710 711
          {
711 712
          final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
712 713
          setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
713 714
          setRenderer(mRenderer);
714 715
          }
716
        catch(Exception ex)
717
          {
718
          act.OpenGLError("This device does not support OpenGL ES 3.0");
719

  
720
          String shading = GLES30.glGetString(GLES30.GL_SHADING_LANGUAGE_VERSION);
721
          String version = GLES30.glGetString(GLES30.GL_VERSION);
722
          String vendor  = GLES30.glGetString(GLES30.GL_VENDOR);
723
          String renderer= GLES30.glGetString(GLES30.GL_RENDERER);
724

  
725
          FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
726
          crashlytics.setCustomKey("GLSL Version"  , shading );
727
          crashlytics.setCustomKey("GLversion"     , version );
728
          crashlytics.setCustomKey("GL Vendor "    , vendor  );
729
          crashlytics.setCustomKey("GLSLrenderer"  , renderer);
730
          crashlytics.recordException(ex);
731
          }
715 732
        }
716 733
      }
717 734

  

Also available in: Unified diff