Android模拟器 3D 加速架构

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

其设计如下:



可以参见官方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(安卓)Wifi模块分析(三)
  2. android(NDK+JNI)---Eclipse+CDT+gdb调试android ndk程序
  3. Android(安卓)Activity的启动
  4. Ubuntu下查找.android/avd
  5. 编译android的linux内核
  6. Ionic 运行报错No resource identifier found for attribute 'ap
  7. android 开机直接运行app并当做手机桌面
  8. Android(安卓)任务和回退堆栈---启动任务
  9. Android出现java.lang.RuntimeException: Can't toast on a thre

随机推荐

  1. 生产系统数据丢失恢复案例
  2. 带你重新认识Linux系统的inode
  3. MySQL产品的生命周期
  4. Linux下块设备查看命令lsblk详解
  5. MySQL安全性解决方案
  6. 编写MySQL Shell插件(REPORT)
  7. 实战:一文带你解决Mysql主从复制日常错误
  8. MySQL的Hash Join能用吗?
  9. 实战:从Mysql数据库frm文件中,提取表结构创
  10. MySQL的Bugs