-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8b1d4c
commit 3cc798b
Showing
52 changed files
with
1,293 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Nuitrack OpenGL Android Studio Sample | ||
|
||
### Requirements | ||
|
||
* **Android Studio**: `v3.1.0` or higher | ||
|
||
### IMPORTANT NOTES | ||
|
||
1. We recommend you to use the latest **Android Studio** version. | ||
2. If you are using one of the latest **Android Studio** versions (`v3.5+`), we strongly recommend you to set the **Gradle** and **Gradle Plugin** to a higher version before you open this project in **Android Studio**. | ||
3. The **Gradle Plugin** version depends on your **Android Studio** version. The **Gradle Wrapper** version depends on your **Gradle Plugin** version. You can learn more about the **Gradle**/**Gradle Plugin** version dependency in the [official Android documentation](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle). | ||
4. If you want to change the **Gradle**/**Gradle Plugin** version: | ||
* Specify the new version of the **Gradle Plugin** in the variable `com.android.tools.build:gradle:3.2.0` in the `{ANDROID_STUDIO_SAMPLE_DIRECTORY}/build.gradle` file; | ||
* Specify the new **Gradle** version in the variable `distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip` in the `{ANDROID_STUDIO_SAMPLE_DIRECTORY}/gradle/wrapper/gradle-wrapper.properties` file. | ||
|
||
## Building the Sample | ||
|
||
1. Open **Android Studio**. | ||
2. Click `Open an existing Android Studio project`. | ||
3. Select the folder `<NuitrackSDK>/Examples/nuitrack_android_studio_gl_sample` and click `OK`. | ||
4. Wait while **Android Studio** configures the project. You may be prompted to install **Android SDK**/**NDK** and **CMake** if they haven't been installed yet on your PC. | ||
5. \[ optional \] If you see any errors during project configuration, for example: `A problem occurred configuring project ':app'.` or `NDK not configured. Install NDK and sync project` **PLEASE DO NOT PRESS ANY BUTTON!** These errors appear if you have an old **Gradle Plugin** and don't have the **NDK** installed (or **Android Studio** can't find it). Please follow the steps below: | ||
* Make sure that you're using correct **Gradle**/**Gradle Plugin** versions (see [Important Notes](#important-notes)) | ||
* Set up the **NDK** location in `File` → `Project Structure` → `SDK location`→ `Android NDK location`. | ||
6. Click the `Make project` button (a green hammer in the top right corner) | ||
***Note**: default target architecture is `armeabi-v7a`. If you want to change the architecture, you need to set the `abiFilters` value to `arm64-v8a` in `build.gradle`.* | ||
7. Select your target Android device and click the `Run (app)` button. |
53 changes: 53 additions & 0 deletions
53
Examples/nuitrack_android_studio_gl_sample/app/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
|
||
defaultConfig { | ||
applicationId "com.tdv.nuitrack.sdk.samples.NuitrackGLSample" | ||
minSdkVersion 19 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
externalNativeBuild { | ||
cmake { | ||
cppFlags "-std=c++11 -fexceptions" | ||
} | ||
} | ||
|
||
ndk { | ||
abiFilters 'armeabi-v7a' | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
externalNativeBuild { | ||
cmake { | ||
path "src/main/cpp/CMakeLists.txt" | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
|
||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'com.google.android.material:material:1.2.1' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||
} |
Binary file added
BIN
+7.6 KB
Examples/nuitrack_android_studio_gl_sample/app/libs/nuitrackhelper.jar
Binary file not shown.
38 changes: 38 additions & 0 deletions
38
Examples/nuitrack_android_studio_gl_sample/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.tdv.nuitrack.sdk.samples.NuitrackGLSample" > | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.NuitrackGLSample" > | ||
<activity android:name=".MainActivity" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
<category android:name="com.nuitrack.intent.category.VICOVR" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="android.app.NativeActivity" | ||
android:label="@string/app_name" | ||
android:configChanges="orientation|keyboardHidden" | ||
android:screenOrientation="sensorLandscape" | ||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> | ||
<meta-data | ||
android:name="android.app.lib_name" | ||
android:value="nuitrack_gl_sample"/> | ||
</activity> | ||
</application> | ||
|
||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | ||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.CAMERA"/> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH" /> | ||
|
||
</manifest> |
34 changes: 34 additions & 0 deletions
34
Examples/nuitrack_android_studio_gl_sample/app/src/main/cpp/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
|
||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
add_library(nuitrack_gl_sample SHARED | ||
${CMAKE_CURRENT_SOURCE_DIR}/android_main.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/NuitrackGLSample.cpp) | ||
|
||
set(NUITRACK_SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../) | ||
|
||
set(ANDROID_ARCH android) | ||
if(ANDROID_ABI STREQUAL "arm64-v8a") | ||
set(ANDROID_ARCH android-arm64) | ||
endif() | ||
|
||
add_library(app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) | ||
|
||
add_library(nuitrack SHARED IMPORTED) | ||
set_target_properties(nuitrack PROPERTIES IMPORTED_LOCATION ${NUITRACK_SDK_PATH}/Nuitrack/lib/${ANDROID_ARCH}/libnuitrack.so) | ||
|
||
add_library(middleware SHARED IMPORTED) | ||
set_target_properties(middleware PROPERTIES IMPORTED_LOCATION ${NUITRACK_SDK_PATH}/Nuitrack/lib/${ANDROID_ARCH}/libmiddleware.so) | ||
|
||
include_directories(${NUITRACK_SDK_PATH}/Nuitrack/include ${ANDROID_NDK}/sources/android/native_app_glue) | ||
|
||
find_library(log-lib log) | ||
find_library(android-lib android) | ||
find_library(egl-lib EGL) | ||
find_library(gles-lib GLESv1_CM) | ||
|
||
target_link_libraries(nuitrack_gl_sample app-glue ${log-lib} ${android-lib} ${egl-lib} ${gles-lib} nuitrack middleware) |
Oops, something went wrong.