Is there a way to check if Android device supports openGL ES 2.0?

后端 未结 7 1043
轻奢々
轻奢々 2020-12-02 23:16

I need to check dynamically if the used device supports openGL ES 2.0. How can i do that?

7条回答
  •  心在旅途
    2020-12-02 23:52

    You can use this code in your code:

                int result;
                ActivityManager activityManager =
                        (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
                ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo();
                if (configInfo.reqGlEsVersion != ConfigurationInfo.GL_ES_VERSION_UNDEFINED) {
                    result= configInfo.reqGlEsVersion;
                } else {
                    result= 1 << 16; // Lack of property means OpenGL ES version 1
                }
    
                Log.e("reqGlEsVersion", String.valueOf(result));
                Log.e("getGlEsVersion", configInfo.getGlEsVersion());
    

提交回复
热议问题