-
Notifications
You must be signed in to change notification settings - Fork 748
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
Showing
151 changed files
with
5,613 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> | ||
</classpath> |
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,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Ch10_MultiTexture</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>com.android.ide.eclipse.adt.ApkBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.openglesbook.multitexture" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="18" /> | ||
|
||
<!-- Tell the system this application requires OpenGL ES 3.0. --> | ||
<uses-feature android:glEsVersion="0x00030000" android:required="true" /> | ||
|
||
<application android:icon="@drawable/icon" | ||
android:label="@string/app_name" | ||
android:allowBackup="false" > | ||
|
||
<activity android:name=".MultiTexture" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
</application> | ||
|
||
</manifest> |
21 changes: 21 additions & 0 deletions
21
Android_Java/Chapter_10/MultiTexture/assets/shaders/fragmentShader.frag
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,21 @@ | ||
#version 300 es | ||
|
||
precision mediump float; | ||
|
||
in vec2 v_texCoord; | ||
|
||
layout(location = 0) out vec4 outColor; | ||
|
||
uniform sampler2D s_baseMap; | ||
uniform sampler2D s_lightMap; | ||
|
||
void main() | ||
{ | ||
vec4 baseColor; | ||
vec4 lightColor; | ||
|
||
baseColor = texture( s_baseMap, v_texCoord ); | ||
lightColor = texture( s_lightMap, v_texCoord ); | ||
|
||
outColor = baseColor * (lightColor + 0.25); | ||
} |
12 changes: 12 additions & 0 deletions
12
Android_Java/Chapter_10/MultiTexture/assets/shaders/vertexShader.vert
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,12 @@ | ||
#version 300 es | ||
|
||
layout(location = 0) in vec4 a_position; | ||
layout(location = 1) in vec2 a_texCoord; | ||
|
||
out vec2 v_texCoord; | ||
|
||
void main() | ||
{ | ||
gl_Position = a_position; | ||
v_texCoord = a_texCoord; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system use, | ||
# "build.properties", and override values to adapt the script to your | ||
# project structure. | ||
|
||
# Project target. | ||
target=android-18 | ||
android.library.reference.1=../../Common/ |
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 @@ | ||
-optimizationpasses 5 | ||
-dontusemixedcaseclassnames | ||
-dontskipnonpubliclibraryclasses | ||
-dontpreverify | ||
-verbose | ||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* | ||
|
||
-keep public class * extends android.app.Activity | ||
-keep public class * extends android.app.Application | ||
-keep public class * extends android.app.Service | ||
-keep public class * extends android.content.BroadcastReceiver | ||
-keep public class * extends android.content.ContentProvider | ||
-keep public class com.android.vending.licensing.ILicensingService | ||
|
||
-keepclasseswithmembernames class * { | ||
native <methods>; | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
public <init>(android.content.Context, android.util.AttributeSet); | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
public <init>(android.content.Context, android.util.AttributeSet, int); | ||
} | ||
|
||
-keepclassmembers enum * { | ||
public static **[] values(); | ||
public static ** valueOf(java.lang.String); | ||
} | ||
|
||
-keep class * implements android.os.Parcelable { | ||
public static final android.os.Parcelable$Creator *; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">Ch10_MultiTexture</string> | ||
</resources> |
65 changes: 65 additions & 0 deletions
65
Android_Java/Chapter_10/MultiTexture/src/com/openglesbook/multitexture/MultiTexture.java
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,65 @@ | ||
package com.openglesbook.multitexture; | ||
|
||
import android.app.Activity; | ||
import android.app.ActivityManager; | ||
import android.content.Context; | ||
import android.content.pm.ConfigurationInfo; | ||
import android.opengl.GLSurfaceView; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
/** | ||
* Activity class for example program that detects OpenGL ES 3.0. | ||
**/ | ||
public class MultiTexture extends Activity { | ||
private final int CONTEXT_CLIENT_VERSION = 3; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
mGLSurfaceView = new GLSurfaceView(this); | ||
if (detectOpenGLES30()) | ||
{ | ||
// Tell the surface view we want to create an OpenGL ES 3.0-compatible | ||
// context, and set an OpenGL ES 3.0-compatible renderer. | ||
mGLSurfaceView.setEGLContextClientVersion(CONTEXT_CLIENT_VERSION); | ||
mGLSurfaceView.setRenderer(new MultiTextureRenderer(this)); | ||
} | ||
else | ||
{ | ||
Log.e("MultiTexture", "OpenGL ES 3.0 not supported on device. Exiting..."); | ||
finish(); | ||
|
||
} | ||
setContentView(mGLSurfaceView); | ||
} | ||
|
||
private boolean detectOpenGLES30() | ||
{ | ||
ActivityManager am = | ||
(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); | ||
ConfigurationInfo info = am.getDeviceConfigurationInfo(); | ||
return (info.reqGlEsVersion >= 0x30000); | ||
} | ||
|
||
@Override | ||
protected void onResume() | ||
{ | ||
// Ideally a game should implement onResume() and onPause() | ||
// to take appropriate action when the activity looses focus | ||
super.onResume(); | ||
mGLSurfaceView.onResume(); | ||
} | ||
|
||
@Override | ||
protected void onPause() | ||
{ | ||
// Ideally a game should implement onResume() and onPause() | ||
// to take appropriate action when the activity looses focus | ||
super.onPause(); | ||
mGLSurfaceView.onPause(); | ||
} | ||
|
||
private GLSurfaceView mGLSurfaceView; | ||
} |
Oops, something went wrong.