9

I am running an Android Virtual Device on my Ubuntu host. It is using the CPU/ABI Intel Atom (x86) and I am using the host GPU. The emulator is using a Kernel-based Virtual Machine.

settings used

This works splendidly as long as I use an OpenGL ES2 context. If my app attempts to create an OpenGL ES3 context however, using...

const EGLint contextAttribs[] = {
    EGL_CONTEXT_CLIENT_VERSION, 3,
    EGL_NONE
};
context = eglCreateContext(display, config, NULL, contextAttribs);

...then I get an EGL_BAD_CONFIG error:

I/biplane ( 2839): EGL: vendor Android version 1.4 Android META-EGL
I/biplane ( 2839): EGL: client apis OpenGL_ES
I/biplane ( 2839): number of EGL configurations that match our preferred criteria: 1
I/biplane ( 2839): R8 G8 B8 A8 DEPTH24
E/EGL_emulation( 2839): tid 2852: eglCreateContext(919): error 0x3005 (EGL_BAD_CONFIG)

Requesting ES3 on a hardware mobile device, works well. But when requesting it from the emulator, it fails. The host machine is perfectly capable of doing OpenGL ES3.0, ES3.1 and ES3.2 as can be seen from glxinfo:

$ glxinfo | grep ES3
    GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility, 
    GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility, 
    GL_NV_ES3_1_compatibility, GL_NV_bindless_multi_draw_indirect, 
    GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility, 
    GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility, 
    GL_NV_ES3_1_compatibility, GL_NV_bindless_multi_draw_indirect, 

Is there a way to run OpenGL ES3 apps on an Android Virtual Device on top of kvm?

Bram
  • 7,440
  • 3
  • 52
  • 94
  • How do you choose the config? Are you using one that supports ES3? – Reto Koradi Nov 25 '16 at 05:52
  • I had pretty much the same problem and gave up after learning that the android emulator doesn't support OpenGL ES3: http://stackoverflow.com/questions/24874066/does-the-android-emulator-support-opengl-es-3-0 – Gordon Gustafson Jan 28 '17 at 22:14

2 Answers2

13

Running GLES3 apps in the emulator is supported in Android Studio 3.0 and higher.

At the time of writing, preview builds of this version are available. See: https://android-developers.googleblog.com/2017/05/android-studio-3-0-canary1.html

After launching the emulator, you need to change a setting, and restart the emulator as depicted below.

Also, make sure your app requests an ES3 context, because the Android sample code gles3jni does not do so.

enter image description here

UPDATE jun 2018

In the latest Android Studio, I can no longer select OpenGL ES3.1, even though it is the same PC.

enter image description here

To make it work, I had to add a file to ~/.android/ directory.

cd ~/.android/
$ echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini
Bram
  • 7,440
  • 3
  • 52
  • 94
  • 4
    Now it in "Advanced" tab – Timur Gilfanov Dec 06 '17 at 21:42
  • 4
    I want to upvote this 100 times! Creaing the file 'advancedFeatures.ini' with "GLESDynamicVersion = on" did the job for me. Although i can only choose OpenGL ES 2.0, the device is creating 3.1 context when requesting it! – kaiser Jul 31 '20 at 14:27
2

Notice : enter image description here

OpenGL SE should be opened in emulator > Setting > Advanced

Not in the ADB page.

andy840119
  • 54
  • 4