This Android OpenGL ES 3.0 Sample was written by Cristiano Ferreira - Software Engineer at Intel Corporation.
By batch-rendering multiple versions of the same mesh, instanced rendering can help developers using OpenGL* ES 3.0 and later dramatically improve performance and resource efficiency. The sample code introduced here demonstrates a simple technique for using this capability.
Instanced rendering allows for the reuse of geometry information, to render multiple instances of the same mesh with a single API call. Developers can use uniforms to apply unique attributes to specific instances, which provides for variation using visual properties such as texture. By reducing overhead—and therefore resource requirements—to render large numbers of elements, instanced rendering offers the potential to improve visual experiences, especially on hardware-constrained mobile devices.
Instancing was first introduced in OpenGL 3.1 as an arb extension (ARB_draw_instanced). This capability has now been added to the mobile space, with its inclusion as a core feature in OpenGL ES 3.0.
The code sample is available for download from GitHub. To build and deploy the application to your Android device, choose either of the approaches described below.
android update project –p .
This sample implements instancing by means of a uniform buffer that contains transform matrices for the model instances. The implementation operates as follows:
While instancing does not require significant added work on the developer’s part, it can significantly increase rendering efficiency and performance.
Instanced rendering is traditionally used for very large numbers of instances, on relatively simple (low poly) meshes. As shown in this sample, however, this capability can also be used effectively for fairly complex structures. The following chart compares the performance using an instanced draw call versus the non-instanced approach with multiple draw calls. As the number of instances increases, instanced rendering demonstrates a clear performance benefit, measured in terms of higher frame rates.
The instancing technique shown in this sample gives developers a simple means of substantially increasing performance in their OpenGL ES 3.0 applications. Instanced rendering lowers the resource requirements to provide rich, dynamic backgrounds, allowing developers to replace more limited billboarding techniques. That helps bring visual experiences that approach desktop-quality 3D graphics on mobile devices.
OpenGL ES: The Standard for Embedded Accelerated 3D Graphics is Khronos Group’s official OpenGL ES page; it describes the standard and provides links to specifications, header files, and reference materials.
Android Developer Guide for OpenGL ES provides background and guidance for use of the OpenGL ES API with Android, including management of compatibility between the two.
OpenGL® ES 3.0 and Beyond: How To Deliver Desktop Graphics on Mobile Platforms describes capabilities of both OpenGL ES 3.0 and 3.1, including how they are supported on Intel’s Bay Trail platform.
Intel® Open Source Technology Center Intel Graphics for Linux* provides downloads, documentation, and community resources related to graphics for Linux on Intel® platforms.
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804