supports Opengl Es - Android android.opengl

Android examples for android.opengl:OpenGL

Description

supports Opengl Es

Demo Code


//package com.java2s;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.os.Build;

public class Main {
    public static boolean supportsOpenglEs2(final Context context) {
        final ActivityManager activityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager
                .getDeviceConfigurationInfo();

        if (configurationInfo.reqGlEsVersion >= 0x20000) {
            return true;
        }/*from  ww  w .j  av  a  2  s  . co m*/

        // Even though the latest emulator supports OpenGL ES 2.0,
        // it has a bug where it doesn't set the reqGlEsVersion so
        // the above check doesn't work. The below will detect if the
        // app is running on an emulator, and assume that it supports
        // OpenGL ES 2.0.
        // Check if the system supports OpenGL ES 2.0.
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
                && (Build.FINGERPRINT.startsWith("generic")
                        || Build.FINGERPRINT.startsWith("unknown")
                        || Build.MODEL.contains("google_sdk")
                        || Build.MODEL.contains("Emulator") || Build.MODEL
                            .contains("Android SDK built for x86"));
    }
}

Related Tutorials