Skip to content

Instantly share code, notes, and snippets.

@chrisledet
Created February 25, 2014 03:57
Show Gist options
  • Select an option

  • Save chrisledet/9202408 to your computer and use it in GitHub Desktop.

Select an option

Save chrisledet/9202408 to your computer and use it in GitHub Desktop.
Utility class for checking supported OpenGL versions on Android
<!-- require want to restrict devices that don't support 2.0 from seeing your app in the marketplace by adding the following -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
public class OpenGLVersionChecker {
final Context context;
final ConfigurationInfo configurationInfo;
public OpenGLVersionChecker(Context context) {
this.context = context;
ActivityManager activityManager = (ActivityManager) this.context.getSystemService(Context.ACTIVITY_SERVICE);
this.configurationInfo = activityManager.getDeviceConfigurationInfo();
}
public boolean isES2Supported() {
return configurationInfo.reqGlEsVersion >= 0x20000;
}
public boolean isES1Supported() {
return configurationInfo.reqGlEsVersion >= 0x10000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment