Does the Android emulator support OpenGL ES 3.0?

心不动则不痛 提交于 2019-11-27 05:25:19

Even OpenGL ES 2.0 support is somewhat limited and buggy in emulator. But for example Nexus4 supports OpenGL ES 3.0. And used N4 is dirt cheap.

Honestly, I don't expect OpenGL ES 3.x support in emulator. It is not a compulsive part of Android specs - this is an optional feature which can be present and can be missing. So I'd recommend to stick to real hardware even for testing of OpenGL ES 3.x. If you need to test features of apps not requiring OpenGL ES 3.0 you are good to go for emulators. But for testing any OpenGL ES (from 1.0 to 3.1) I'd strongly recommend to use real devices for 2 reasons - firstly, GL environment on real devices is stable (on emulator it has limited features, buggy and unstable, can even crash emulator sometimes), and secondly, you may find a lot of OpenGL drivers/hardware bugs/limitations on different real GPUs.

Jamal Eason

The latest Android Emulator now supports OpenGL ES 3.0. To use OpenGL ES 3.0, your development machine needs a host GPU graphics card that supports OpenGL 3.2 or higher on Microsoft® Windows® or Linux.

See: https://android-developers.googleblog.com/2017/05/android-studio-3-0-canary1.html

The gles3jni sample app from the NDK is a good option to try it out.

If it fails with:

java.lang.RuntimeException: createContext failed: EGL_BAD_CONFIG

also try to run first on host:

echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini

as the devs are currently whitelisting supported host GPUs, and that overrides it, see also: https://issuetracker.google.com/issues/68496715

Neither the Android Emulator and system images nor Genymotion currently support OpenGL ES Version 3.0.

As I write this the latest (Rev. 1) ARM and x86 system images for Android 5.1.1 (API 22) report that they support OpenGL ES Version 2.0 and not 3.0.

Similarly, Genymotion's Nexus 5 Android 5.1.0 API 22 virtual device reports only OpenGL ES Version 2.0 support.

You can use the code below to check support under future system images and emulators:

package com.example.opengltest;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

public class OpenGLESVersionActivity extends Activity {

    private static final String TAG = "OpenGLESVersionActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final ActivityManager activityManager =
                (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo =
                activityManager.getDeviceConfigurationInfo();
        String versionText = "Device Supported OpenGL ES Version = " + configurationInfo.getGlEsVersion();
        Toast.makeText(this, versionText, Toast.LENGTH_LONG).show();
        Log.d(TAG, versionText);
    }

}

I found the version that the emulator supported by running glGetString(GLES20.GL_VERSION). It appears that the emulators I tested do not support OpenGL ES 3.0 or higher, but I don't want to assume that what they are reporting is what they actually support, so I'm not making any promises that this word is final.

On my Nexus 5

OpenGL ES 3.0 V@104.0 AU@ (GIT@Id3510ff6dc)

Android emulator using HAXM

OpenGL ES 2.0 (2.1 NVIDIA-10.2.7 310.41.25f01)

Genymotion emulator

OpenGL ES 2.0 (2.1 NVIDIA-10.2.7 310.41.25f01)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!