Android simulator and OpenGL Es3: EGL_ BAD_ CONFIG
I am running Android virtual device on the Ubuntu host. It is using CPU / ABI Intel Atom (x86), and I am using the host GPU. The emulator is using kernel based virtual machine. @ H_ 502_ 3@
As long as I use OpenGL ES2 context, it can work well. However, if my application tries to create OpenGL Es3 context, please use
const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};
context = eglCreateContext(display, config, NULL, contextAttribs);
... and then I got 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)
The effect of requesting Es3 on hardware mobile devices is very good. However, when it is requested from the emulator, it will fail. From glxinfo, it can be seen that the host can fully execute OpenGL es3.0, es3.1 and es3.2:
$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 any way to run OpenGL Es3 applications on Android virtual devices on KVM?
resolvent:
Android studio 3.0 and later supports running gles3 applications in the simulator
A preview version of this version is available at the time of writing. View: https://android-developers.googleblog.com/2017/05/android-studio-3-0-canary1.html
After starting the emulator, you need to change the settings and restart the emulator as shown in the figure below
Also, make sure your app requests the Es3 context, because the Android sample code gles3jni won't
Updated June 2018
In the latest Android studio, OpenGL es3.1 cannot be selected even if it is the same PC
In order for it to work properly, I must add a file in the ~ /. Android / directory
cd ~/.android/
$echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini