-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Copyright (c) 2012-present Lightweight Java Game Library | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
- Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
- Neither the name Lightweight Java Game Library nor the names of | ||
its contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[](https://github.com/LWJGL/android-test/blob/master/LICENSE.md) | ||
 | ||
[](https://slack.lwjgl.org/) | ||
|
||
## LWJGL 3 - Android example project and tests | ||
|
||
Build instructions for the Android version of lwjgl3: | ||
|
||
- `clone` [lwjgl3](https://github.com/LWJGL/lwjgl3) and `checkout` the `android` branch. | ||
- `SET/export` the `ANDROID_SDK_HOME` environment variable. Its value should be the root of the Android SDK. The Android NDK must also be installed under the root, in the default `ndk-bundle` subdirectory. | ||
- Run `ant compile-templates`. This will take 1-2 minutes. | ||
- Run `ant aar`. This will produce an `lwjgl.aar` file in the `bin/android/` folder. | ||
- Copy `lwjgl.aar` to the `android-test` repository, in the `lwjgl` folder. | ||
|
||
Build instructions for the Android demos: | ||
|
||
- Open the root in Android Studio. | ||
- Wait for gradle synchronization and indexing to complete. | ||
- Build the project. | ||
- Connect a platform 24 compatible device, either via USB or Wi-Fi. | ||
- Launch either the `gears` or `hellovulkan` run configurations. (shortcut: `Alt+Shift+F10`) | ||
|
||
Installation of Vulkan validation layers: | ||
|
||
- Create a JNI library folder for the target architecture. For example: | ||
* `hellovulkan/src/main/jniLibs/arm64-v8a/` or | ||
* `hellovulkan/src/main/jniLibs/armeabi-v7a/` | ||
- Copy the shared libraries from the corresponding folder in the Android NDK. For example: | ||
* `<sdkroot>/ndk-bundle/sources/third_party/vulkan/src/build-android/jniLibs/arm64-v8a/` or | ||
* `<sdkroot>/ndk-bundle/sources/third_party/vulkan/src/build-android/jniLibs/armeabi-v7a/` | ||
- Set the `VALIDATE` variable to `true` in `HelloVulkan.java:53` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:2.3.0-beta3' | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
jcenter() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.2" | ||
|
||
defaultConfig { | ||
applicationId "org.lwjgl.demo.android.gears" | ||
minSdkVersion 24 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
|
||
multiDexEnabled true | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles 'proguard-rules.pro', getDefaultProguardFile('proguard-android.txt') | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:25.1.1' | ||
compile 'org.joml:joml:1.9.3-SNAPSHOT' | ||
compile project(':lwjgl') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in G:\PROGRAMS\Android\sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
-optimizations !field/*,!class/merging,* | ||
-optimizationpasses 5 | ||
|
||
-keepclassmembers class org.lwjgl.system.** { *; } | ||
-keepclassmembernames class org.lwjgl.system.** { *; } | ||
|
||
-keepclassmembers class sun.misc.Unsafe { *; } | ||
-keepclassmembernames class sun.misc.Unsafe { *; } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.lwjgl.demo.android.gears"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#version 300 es | ||
|
||
precision mediump float; | ||
|
||
uniform vec4 u_COLOR; | ||
|
||
in float v_Shade; | ||
|
||
layout(location = 0) out vec4 out_Color; | ||
|
||
void main() { | ||
out_Color = vec4(u_COLOR.xyz * v_Shade, u_COLOR.w); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#version 300 es | ||
|
||
uniform mat4 u_MVP; | ||
uniform mat3 u_NORMAL; | ||
|
||
uniform vec3 u_LIGHT; | ||
|
||
layout(location = 0) in vec3 in_Position; | ||
layout(location = 1) in vec3 in_Normal; | ||
|
||
out float v_Shade; | ||
|
||
void main() { | ||
vec3 normal = normalize(u_NORMAL * in_Normal); | ||
v_Shade = max(dot(normal, u_LIGHT), 0.0); | ||
gl_Position = u_MVP * vec4(in_Position, 1.0); | ||
} |