Open topic with navigation
Sample: Tegra Android Native Globe Application
The Globe (
sample_apps\native_globe) application is a simple Android NDK NativeActivity-based application that demonstrates simple 3D rendering in native code using Android. It also demonstrates reasonable reactions to common Android lifecycle events. The Globe application is written using the NVIDIA-expanded version of
nv_native_app_glue, but the basic concepts of handling Android lifecycle events are applicable to Java/native and pure native NDK applications independent of the particular framework library.
Highlights of the Application
The highlights of the Globe application at the user level include:
- Interactive 3D rendering of a shader-based “globe” object.
- Multiple OpenGL ES-rendered UI “dialogs” leading the user through the application’s responses to Android lifecycle events. These are designed to simulate the in-game-engine rendered UIs common to most 3D games, rather than using Android’s Java-based UI rendering.
- Correct, responsive handling of in-application device orientation changes.
Highlights of the Application Code
In terms of code-level inspection, the Globe application provides quite a few useful examples to developers, including:
- Handling of major Android lifecycle events corresponding to common user actions, including:
- Background’ing the application with the Home button.
- Pressing the Back button.
- Suspending and Resuming the device with the power button.
- Changing the device orientation at any time.
- Touch-based user input.
- Sound play/pause.
- Examples of how to handle the Back button; the application chooses to “eat” the event internally or pass the event to Android, depending on the particular UI state.
- Use of the
nv_native_app_glue example framework.
NVIDIA® GameWorks™ Documentation Rev. 1.0.200608 ©2014-2020. NVIDIA Corporation. All Rights Reserved.