The new Tegra Android Native Samples Pack includes code samples and support libraries that are designed to help developers with the most common Android Native 3D game coding issues.
Lars M. Bishop, Senior Engineer, NVIDIA Tegra Developer Technologies
We have just released our latest, upgraded Tegra Android Native Samples Pack, which helps developers looking to create high-end 3D games and apps using native (C/C++) code on Android. We’ve specifically targeted common issues for Android developers in practice, rather than the more common “assortment of cool 3D mini-demos”. We love 3D mini-demos, too; I’ve written many over the years and will hopefully write many more, but for this version of our samples pack, we wanted to do things differently.
Back in February, in the lead-up to GDC 2012, while preparing for my GDC presentation on Android native game development tips and pitfalls (those slides and my complete notes are available at NVIDIA's GDC 2012 content archive page, BTW) I decided to focus the arc of the presentation to be more practical. Rather than “yet another deck of Android lifecycle and GPU performance” slides, I tackled the top issues we’d seen in a wide range of Android games.
At the same time, we began to move our existing samples pack to Android’s NativeActivity. I wanted to build out our existing samples pack to focus on those same common issues from my talk, focusing on NativeActivityapps. A few of us in NVIDIA’s Tegra Developer Technologies team sat down and reviewed the main support questions and bugs we’d seen on 3D games in the Android Market. NVIDIA’s own QA reports for upcoming and past Tegra Zone games reinforced these same, common issues. Much of the samples pack came straight from these items:

  • Android lifecycle behavior of all kinds, especially in pure native apps (As detailed in our whitepaper on Android Lifecycle Behavior)
  • Use of Java-only Android features in native apps, such as launching an external app or displaying Android UI elements
  • Accelerometer orientation-handling across tablets and phones (as discussed in our whitepaper on Accelerometer Handling in Android)
  • Correct multi-finger gesture tracking
  • Game controller support in native apps

The new samples and my GDC talk focused on these areas. We extended the existing Google-supplied NativeActivity“wrapper”, native_app_glueto add a few features we found useful and surrounded NativeActivitywith small helper libs for important game features. We tried to make all of the samples handle at least basic Android lifecycle, and provided two that are designed to be pretty complete examples of how to handle it. Since GDC, we added several more samples to the pack. One was dynamically changing the rendering resolution of a 3D native app on Android while still filling the screen. This has become a key feature for effects-heavy games needing to run on the increasingly wide range of screen resolutions seen on Android tablets.
Finally, one area of samples came from a completely different direction: multimedia and Augmented Reality. Tegra not only fully supports and accelerates in hardware the OpenMAX AL multimedia APIs released in the Android NDK platform level 14, it extends them to include OpenMAX AL – OpenGL ES interop and protected/encrypted content. With these extensions, powerful multimedia tools like video editors, augmented reality apps, games and premium video content players can all be supported and accelerated on Tegra. I’d like to welcome you to try out the new samples pack – it’s a part of the latest Tegra Android Development Pack and Tegra Android Tools Pack, and can be downloaded from the Develop for Tegra page.
Please give it a try - we'll be updating it over the coming weeks and months to add lots more topics, samples and libraries!