0

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

3
  • 1
    All Android devices have a GPU, AFAIK. Commented 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. Commented 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. Commented Nov 19, 2011 at 0:51

1 Answer 1

2

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.