Android 3D Emulation Architecture Understanding

Source: Internet
Author: User

Android Emulator provides the user with the GPU on option, which means using the GPU of Host (which is the PC running Emulator). Of course, the PC must have the OpenGL driver installed.


In the implementation is to replace the libglesv1_cm.so libglesv2.so, when the system calls GL's function, the call is packaged as a stream, and through the pipe sent to the host side processing, into the conversion to host OpenGL call.

Light is not enough, but also to Libegl, Libgralloc are replaced, because to call the host side of OpenGL must have rendercontext, so to the Android Egl also converted to host XGL call (if you use Ubuntu) .


Create

Normally, when an APK process needs to create a form, it calls the EGL function to create the Surface, also calls the Gralloc function to create the memory to hold the raster required by the Surface, and then associate the two, which is done in this process, but in the Android 3D emulation architecture, the form cannot be created directly, but must be created by sending a command to the host side render to invoke the XGL command .

Surface corresponds to the windowsurface in the 3D Emulation, and the raster memory corresponds to Colorbuffer in 3D Emulation.



The FrameBuffer is a virtual FrameBuffer in 3D emulation, and he centrally manages Colorbuffer, Windowsurface, and Rendercontext.


Update

When the APK calls Swapbuffers (that is, the screen that has already been painted, which requires each surface to provide image memory, Surfaceflinger to be processed and displayed on the screen), you can imagine that the drawing with OpenGL is over, and now it's a series of memory copy, Colorbuffer the image of OpenGL to draw the image read out.

The eglmakecurrent parameter of Elg provides the first surface to draw things, and the second is to read

public boolean eglmakecurrent (Egldisplay display, Eglsurface draw, Eglsurface read, eglcontext context);

The application should use Eglsurface draw when drawing something, this surface is backstage, invisible, just to be able to successfully call OpenGL for hardware rendering

Now on the screen, you need to read back the surface raster data from the previous draw, of course this is provided by the Eglmakecurrent parameter

Read the surface raster memory for Surfaceflinger operation, the last generated screen image in Framebuffer, can be directly on the screen



At last you're in the emulator, and there's no problem running a racing game.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.