As many developers struggle to use EGLImage in the Native Development Kit (NDK) under Android™, I wanted to help a bit. Before I dive into more details I would like to explain briefly what the EGLImage extension is. EGLImage is an EGL extension to be used when texture content is going to be updated very often – more or less every frame. As you might already know, the glTexImage and glSubTexImage functions are not suitable for this kind of operation because data is being copied/converted in the drivers from CPU to GPU memory in order to be compliant against the Khronos standard. The EGLImage extension makes use of contemporary mobile chipsets where the CPU and GPU share the same physical memory. As long as they share the same memory, copying data may not be required in certain cases and this is exactly where EGLImage comes in. Once the content of the EGLImage has been updated on the CPU it has an immediate effect on the texture being rendered on a screen.

With that in mind I decided to write a simple example of how to use the extension, as this is not an easy task, especially for people who are not very familiar with Android, and especially because prebuilt Android is usually also required. But do not be afraid if you do not want to build Android on your own. I have implemented a simple library called gbuffer, which is a wrapper on top of the Android interface and using this you will not have to build Android. Once you have developed your application with the library it should run on any other non-modified Android platforms that support the EGLImage extension. The library itself does not contain any specific implementation for the ARM® Mali™ GPU architecture.

Please see the example source code and the “EGLImage – updating a texture without copying memory under Android whitepaper” which explains the above in more detail and has a step by step guide to what you should do in order to get EGLImage up and running in your application.