Android模拟器 3D 加速架构

运行 Android 模拟器的有个 GPU 开关,当打开 GPU 开关 3D 加速功能将转给 HOST的 GPU, 否则就是用 Soft 3D(CPU 执行 GPU 运行), 因此勾选此项可以让3D程序运行流畅。

其设计如下:


Android 模拟器 GPU ON_第1张图片

可以参见官方sdk/emulator/opengl/DESIGN

值得注意的是 Android 支持的 GLES 和 OPEN GL 还有区别,所以有 TRANSLATOR 模块进行转化。


Ubunu Linux 下面使用问题若干

在 windows 使用模拟器好像没有什么问题,因为 window 也是”游戏机“, opengl 驱动都是安装好的。 Ubunu Linux 下面使用问题若干。


运行模拟器

下载官方提供的 sdk on Linux

运行 ./android , 弹出SDK Manager界面,去下载 SDK支持文件

运行./android avd, 弹出 AVD Manager界面 , 去创建一个AVD( android virtual devices), 比如 avd1

用命令运行模拟器 (如果在命令行中没有开 gpu on, 可以在参数中指定)

./emulaotr -avd avd1 -gpu on -verbose

Ubuntu下你的显卡没有安装 OpenGL

如果Ubuntu下你的显卡没有安装 OpenGL, Android 依然能启动,但根据下面的 Log 知道是用 software renderer.

Failed to create Context 0x3005

emulator: Can't start OpenGLES renderer?
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.


自编译 SDK,gpu on不能运行

如果自己编译的 sdk 还是安装上面的运行步骤, 并不能把 Android 启动,有下面的错误。


emulator: Initializing hardware OpenGLES emulation support

Failed to create Context 0x3005
emulator: KVM mode auto-enabled!

destroyOpenGLSubwindow not implemented for separate renderer process !!!
createOpenGLSubwindow not implemented for separate renderer process !!!
repaintOpenGLDisplay not implemented for separate renderer process !!!
emulator: Realistic sensor emulation is not available, since the remote controller is not accessible:


这应该是 模拟器没有自动切换为 soft 3d, 仍然向不存在的模拟器要构建的 hardware 3d 中pipe 通信,结果失败。


Virtual box中跑 ubuntu 再跑emulator

在 Virtual box 中运行 Ubuntu 12.04, 再在启动运行运行 Android 模拟器

Android 模拟器可以运行,就是非常慢


因为Virtual box虚拟的设备没有3d设备,得到下面的错误

emulator: Initializing hardware OpenGLES emulation support
OpenGL Warning:Failed to connect to host. Make sure 3D acceleration is enabled for this VM.


在Virtual box中勾选3D加速,再次启动 Ubuntu, 再运行 android emulator

得到下面log,可见Virtual box提供3d 运行android emulator 还是有问题

Failed to create Context 0x3005
emulator: Can't start OpenGLES renderer?
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.



更多相关文章

  1. Android Studio 配置模拟器AVD存放路径(默认在c盘,解决c盘空间不够
  2. 如何在电脑上安装模拟器体验Android 4.0
  3. 16_Android生命周期再介绍,通过androidconfigChanges属性让界面旋
  4. 增加android模拟器的内存大小
  5. Android学习笔记(一)――Android应用的界面编程
  6. 在Android模拟器中安装和卸载apk应用
  7. Android 如何在关于手机界面添加个图片

随机推荐

  1. 当谈论迭代器时,我谈些什么?
  2. Python 之父撰文回忆:为什么要创造 pgen
  3. 从 Python 之父的对话聊起,关于知识产权、
  4. Python 为了提升性能,竟运用了共享经济
  5. 如何美观地打印 Python 对象?这个标准库可
  6. Python 浮点数的冷知识
  7. 金牌厨师Pandas:听说Excel处理数据分行快
  8. 由浅入深:Python 中如何实现自动导入缺失
  9. Python 内存分配时的小秘密
  10. Python 依赖库管理哪家强?pip、pipreqs、p