我需要动态检查所使用的设备是否支持openGL ES 2.0。
我怎样才能做到这一点?
最佳答案
是的。以下代码可以解决问题:
final ActivityManager activityManager =
(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo =
activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
阅读此以获取更多信息:
http://www.learnopengles.com/android-lesson-one-getting-started/
您可能还需要通过在 list 中添加以下内容来限制不支持2.0的设备在市场上看到您的应用程序:
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
另请参见the doc of
uses-feature
。