The Android Diaries | The PowerVR Graphics SDK for the Android OS
The PowerVR Graphics SDK is a cross-platform toolkit written in C/C++, designed to support all aspects of 3D graphics development and enable users to get the most out of the graphics acceleration hardware available to them. It runs on a wide range of devices, but is primarily written and optimized for those that contain PowerVR GPUs.
The SDK consists of two key components; thorough documentation to guide developers, and a wealth of source code including highly optimized example applications, a cross-platform abstraction framework, and helper libraries for commonly used functionality.
The PowerVR Graphics SDK is provided for Windows, OS X and Linux, and can target a variety of operating systems (including Android, iOS and PC emulation on your development machine).
C++ on Android…I thought I could only use Java?
The PowerVR Graphics SDK is written in C++ as it is the language favoured by developers for high-performance, cross-platform applications. Although we do not provide a Java version of the SDK, the source code is very straightforward and well commented. The concepts and techniques are important here – not the language they’re implemented in.
Building a C++ application for Android using the Android NDK and SDK consists of two stages; generating the native (C/C++) library and then building the wrapper around it.
Native code is built into one dynamic library (.so) file per CPU architecture that is being targeted. Once the native code libraries have been built, the Java wrapper layer can then be automatically generated by the Android SDK build. The result of this second build stage is an APK package containing your native .so libraries, the Java wrapper and any assets that were included in your Android project directory (e.g. textures, shaders etc). If the APK contains native libraries for a variety of CPU architectures, the Java code will pick the correct one for the current device at run-time.
How can I get the PowerVR Graphics SDK for Android?
There are two versions of our PowerVR Graphics SDK v3.1 for Android; the first is a standalone variant designed to integrate into the Eclipse IDE (Option 1), and the second is better suited to developers that are targeting multiple operating systems and don’t mind using the command-line (Option 2). The choice between the two is down to personal preference – if you would prefer to use an IDE to manage your projects and debug applications, then Option 1 is the way to go.
In addition to the PowerVR Graphics SDK, you will also need the Android NDK and the Android SDK (or Apache ANT) to build and deploy to Android devices. For the Eclipse SDK, you will also need the Android Eclipse add-in. These packages can be downloaded from the following locations:
Option 1: A recent addition to our offering is our Android SDK Manager add-in. This variant of our SDK is designed for Eclipse IDE integration. You can download the SDK by following these simple steps:
- Open the Android SDK Manager
- Open the Tools–>Manage Add-on Sites window and click the User Defined Sites tab
- Click to New… and add the following URL: http://install.powervrinsider.com/androidsdk.xml
- The PowerVR SDK should now appear on the Packages list (Under API 10). There is a package per graphics API. We recommend the OpenGL ES 2.0 API for current devices as it is widely supported and is much more flexible than OpenGL ES 1.x.
Option 2: Alternatively, you can get the SDK by registering as a PowerVR Insider and then downloading the installer for your development machine (Windows, OSX or Linux). During the simple installation process, you then need to select Android as your target OS and choose your desired graphics API/s (OpenGL ES 1.x, 2.0 and 3.0). We recommend the OpenGL ES 2.0 API for current devices as it is widely supported and is much more flexible than OpenGL ES 1.x.
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.