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.
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?
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.
Android includes support for high performance 2D and 3D graphics with the Open Graphics Library (OpenGL), specifically, the OpenGL ES API. OpenGL is a cross-platform graphics API that specifies a standard software interface for 3D graphics processing hardware.
Android supports OpenGL both through its framework API and the Native Development Kit (NDK).
OpenGL in Android is a graphics library that is used for 2D and 3D graphics development in Android applications. OpenGL provides cross-platform APIs. It processes high-performance data transfer between CPU and GPU. OpenGL supports the android native development kit(NDK) for graphics features development.
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.
UPDATE jun 2018
In the latest Android Studio, I can no longer select OpenGL ES3.1, even though it is the same PC.
To make it work, I had to add a file to ~/.android/ directory.
cd ~/.android/
$ echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With