GPU版本,渲染器,Android版供应商

时间:2015-08-10 08:48:47

标签: android version gpu renderer vendor

我想找到GPU供应商,它的版本和渲染器。 我使用过这段代码: -

 renderer = GLES10.glGetString(GL10.GL_RENDERER);           
 vendor = GLES10.glGetString(GL10.GL_VENDOR);
 version = GLES10.glGetString(GL10.GL_VERSION);

适用于Android 4.3及更高版本,但是当我在Android 2.3.6上运行此代码时,它会返回null。

但是,检查以下代码检查GPUVersion,它返回“2.0”并返回2.3.6: -

final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();               
    GPUVersion = configurationInfo.getGlEsVersion();

但仍然以上3行返回null。

有没有办法获取所有设备的上述信息。

1 个答案:

答案 0 :(得分:0)

有时,在不同Android版本中获取值的唯一方法是根据您运行的版本来拆分方法。你可以这样做:

public static String getGlVersion(Context ctx) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        ActivityManager am = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
        ConfigurationInfo configurationInfo = am.getDeviceConfigurationInfo();               
        return configurationInfo.getGlEsVersion();
    } else {
        return GLES10.glGetString(GLES10.GL_VERSION);
    }
}

请注意,这可能不适用于所有版本,您可能需要将方法拆分为更多情况或更改用于比较的最小SDK_INT(我怀疑例如Honeycomb它已经需要第一种方法,但还没有测试过它。)

相关问题