I want to know if an Android device has GPU or not, is there any way to determine that from code? I've looked into cpufeatures.h in NDK but there seems not to be anything regarding GPU
-
1All Android devices have a GPU, AFAIK.CommonsWare– CommonsWare2011-11-18 17:41:17 +00:00Commented Nov 18, 2011 at 17:41
-
Could you, please, tell me the source of this information? I'm pretty sure my HTC Wildfire doesn't have one.Alexander– Alexander2011-11-18 21:29:19 +00:00Commented Nov 18, 2011 at 21:29
-
I am the source of this information. Apparently I am mistaken, though I feel very confident that the vast majority of Android devices have GPUs. Your Wildfire is an outlier.CommonsWare– CommonsWare2011-11-19 00:51:01 +00:00Commented Nov 19, 2011 at 0:51
Add a comment
|
1 Answer
Here is the trick,
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager
.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (supportsEs2) {
Log.i("JO", "configurationInfo.reqGlEsVersion:"
+ configurationInfo.reqGlEsVersion + "supportsEs2:"
+ supportsEs2);
// Request an OpenGL ES 2.0 compatible context.
myGlsurfaceView.setEGLContextClientVersion(2);
final DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
// Set the renderer to our demo renderer, defined below.
myRenderer = new MyRenderer(this, myGlsurfaceView);