Since it first hit commercial devices in 2008, the Android Operating System (OS) has gained a significant market share and became one of the main OSes for mobile device manufacturers. A driving factor behind its dominance is the large number of applications available for it. As high-performance, low-power GPUs from Imagination’s PowerVR Series5XT graphics family have become common place in these devices, the demand for efficient, high-quality 3D and 2D graphics in applications has increased.

Android March 2013 distribution

When it comes to writing graphics applications for Android, there are two options to consider; Java and Native(C/C++)

Java

A key strength of Java is its Just-In-Time (JIT) compilation. This feature compiles Java application bytecode into CPU specific instructions on device, which makes Java code extremely portable between platforms that have a Java Virtual Machine (JVM). However, the reliance on the JVM makes it difficult to port the code to devices that do not have a JVM.

Java JIT Android

Java is the primary language for Android development. The Android SDK contains a wide array of tools that enable developers to quickly and easily develop, debug and profile applications written in Java.

You can find out more about the Android SDK here: http://developer.android.com/sdk/index.html

Native(C/C++)

Although C/C++ code has to be compiled for specific CPU architectures, almost all devices available to developers have compilers for these native languages. This makes C/C++ code extremely portable between devices and OSs.

To complement the Android SDK, Google provide the NDK for compiling C/C++ code.

Android NDK app

You can find out more about native development on Android here: http://developer.android.com/tools/sdk/ndk/overview.html

Writing your first Android graphics application

We’ve covered programming languages, so the next question becomes – how can I write an application that utilizes the GPU for my 3D rendering?

To enable developers, Android devices include drivers for the Khronos OpenGL ES graphics APIs. These APIs allow developers to construct a 3D scene and issue rendering work to the GPU (http://www.khronos.org/registry/gles/).

As you may be realising, the world of 3D graphics programming can be a little daunting… Fortunately, we’re here to help with the PowerVR Graphics SDK!

Since its v3.0 release in September 2012, the PowerVR SDK has been downloaded from over 65,000 unique IP addresses, with a majority of users choosing Windows as their development of choice.

The PowerVR Graphics SDK v3.0 supports the most recent versions of the OpenGL ES API, including 1.1, 2.0 and 3.0. In terms of cores, we’ve added the PowerVR G6200 and G6400 Series6 IP cores to the list, alongside the already well-known Series5 and Series5XT families. A breakdown of each tool, what’s been updated and what’s new can be found here.

PowerVR Graphics SDK v3.0

January 2013 saw the release of the PowerVR Graphics SDK v3.0 r2, bringing native support for the BlackBerry 10 operating system as well as seamless integration with Android’s SDK Manager tool. We expect PowerVR Insiders to start taking advantage of these new additions, giving them the possibility to port applications between operating systems more easily as well as help them work faster and more reliably.

The Android Diaries’ is a series of blog posts, articles and tutorials where we focus on all aspects of graphics development on Android, the Android SDK as well as Android-specific APIs like Renderscript or Filterscript. If you have any Android-related questions, ideas or suggestions, please leave a comment in the box below or start a discussion on our PowerVR-dedicated forum and we will get back to you as soon as possible. Make sure you also follow us on Twitter (@ImaginationPR and @PowerVRInsider) for the latest news and updates from Imagination and the PowerVR Insider developer programme.

Guillem Vinals Gangolells has contributed to this article.

About the author: Joe Davis

Profile photo of Joe Davis

Joe Davis leads the PowerVR Graphics developer support team. He and his team support a wide variety of graphics developers including those writing games, middleware, UIs, navigation systems, operating systems and web browsers. Joe regularly attends and presents at developer conferences to help graphics developers get the most out of PowerVR GPUs. You can follow him on Twitter @joedavisdev.

View all posts by Joe Davis