Get the major openGL version that is actually available on this device (ie 3). - Android android.opengl

Android examples for android.opengl:OpenGL

Description

Get the major openGL version that is actually available on this device (ie 3).

Demo Code


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

public class Main {
    /**// ww  w .j  a v a 2  s.co m
     * Get the major openGL version that is actually available on this device (ie 3).
     *
     * @param context
     * @return
     */
    public static int getDeviceGLMajorVersion(Context context) {
        int deviceGLVersion = getDeviceGLVersion(context);
        return deviceGLVersion >> 4;
    }

    /**
     * Gets the openGL version that is actually available on this device (ie GL_VERSION_31).
     *
     * @param context
     * @return
     */
    public static int getDeviceGLVersion(Context context) {
        final ActivityManager activityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager
                .getDeviceConfigurationInfo();
        return configurationInfo.reqGlEsVersion;
    }
}

Related Tutorials