Android仿真器和OpenGL ES3:EGL_BAD_CONFIG [英] Android Emulator and OpenGL ES3: EGL_BAD_CONFIG

查看:471
本文介绍了Android仿真器和OpenGL ES3:EGL_BAD_CONFIG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Ubuntu主机上运行 Android虚拟设备. 它正在使用CPU/ABI Intel Atom(x86),而我正在使用主机GPU. 模拟器正在使用基于内核的虚拟机.

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.

只要我使用OpenGL ES2上下文,它就可以出色地工作. 但是,如果我的应用尝试创建OpenGL ES3上下文,请使用...

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);

...然后出现一个 EGL_BAD_CONFIG 错误:

...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)

在硬件移动设备上请求ES3效果很好. 但是,当从仿真器请求它时,它会失败. 从glxinfo可以看出,主机完全能够执行OpenGL ES3.0,ES3.1和ES3.2:

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, 

是否有办法在kvm之上的Android虚拟设备上运行OpenGL ES3应用程序?

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

推荐答案

Android Studio 3.0及更高版本支持在模拟器中运行GLES3应用.

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

在撰写本文时,此版本的预览版本可用. 请参阅: https://android-developers.googleblog .com/2017/05/android-studio-3-0-canary1.html

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.

此外,请确保您的应用请求ES3上下文,因为Android示例代码gles3jni并未这样做.

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

2018年6月更新

在最新的Android Studio中,即使它是同一台PC,我也无法再选择OpenGL ES3.1.

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

要使其正常工作,我必须在〜/.android/目录中添加一个文件.

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

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

这篇关于Android仿真器和OpenGL ES3:EGL_BAD_CONFIG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆