Skip to content

Commit

Permalink
render texture on the cube
Browse files Browse the repository at this point in the history
  • Loading branch information
burt authored and burt committed Jun 23, 2016
1 parent cbced40 commit 99ef855
Show file tree
Hide file tree
Showing 50 changed files with 1,823 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 06-6.DepthAndCulling/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 07-1.Texture/.gitignore
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
1 change: 1 addition & 0 deletions 07-1.Texture/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions 07-1.Texture/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions 07-1.Texture/.idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 07-1.Texture/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions 07-1.Texture/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions 07-1.Texture/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions 07-1.Texture/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions 07-1.Texture/.idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 07-1.Texture/app/.gitignore
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions 07-1.Texture/app/build.gradle
@@ -0,0 +1,26 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "kr.pe.burt.android.texture"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
17 changes: 17 additions & 0 deletions 07-1.Texture/app/proguard-rules.pro
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/burt/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 *;
#}
@@ -0,0 +1,13 @@
package kr.pe.burt.android.texture;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
20 changes: 20 additions & 0 deletions 07-1.Texture/app/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="kr.pe.burt.android.texture">

<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>
@@ -0,0 +1,79 @@
package kr.pe.burt.android.texture;

import kr.pe.burt.android.texture.glkit.ShaderProgram;

/**
* Created by burt on 2016. 6. 23..
*/
public class Cube extends Model {

static final float vertices[] = {
// Front
1, -1, 1, 1, 0, 0, 1, 1, 0, // 0
1, 1, 1, 0, 1, 0, 1, 1, 1, // 1
-1, 1, 1, 0, 0, 1, 1, 0, 1, // 2
-1, -1, 1, 0, 0, 0, 1, 0, 0, // 3

// Back
-1, -1, -1, 0, 0, 1, 1, 1, 0, // 4
-1, 1, -1, 0, 1, 0, 1, 1, 1, // 5
1, 1, -1, 1, 0, 0, 1, 0, 1, // 6
1, -1, -1, 0, 0, 0, 1, 0, 0, // 7

// Left
-1, -1, 1, 1, 0, 0, 1, 1, 0, // 8
-1, 1, 1, 0, 1, 0, 1, 1, 1, // 9
-1, 1, -1, 0, 0, 1, 1, 0, 1, // 10
-1, -1, -1, 0, 0, 0, 1, 0, 0, // 11

// Right
1, -1, -1, 1, 0, 0, 1, 1, 0, // 12
1, 1, -1, 0, 1, 0, 1, 1, 1, // 13
1, 1, 1, 0, 0, 1, 1, 0, 1, // 14
1, -1, 1, 0, 0, 0, 1, 0, 0, // 15

// Top
1, 1, 1, 1, 0, 0, 1, 1, 0, // 16
1, 1, -1, 0, 1, 0, 1, 1, 1, // 17
-1, 1, -1, 0, 0, 1, 1, 0, 1, // 18
-1, 1, 1, 0, 0, 0, 1, 0, 0, // 19

// Bottom
1, -1, -1, 1, 0, 0, 1, 1, 0, // 20
1, -1, 1, 0, 1, 0, 1, 1, 1, // 21
-1, -1, 1, 0, 0, 1, 1, 0, 1, // 22
-1, -1, -1, 0, 0, 0, 1, 0, 0, // 23

};

static final short indices[] = {

// Front
0, 1, 2,
2, 3, 0,

// Back
4, 5, 6,
6, 7, 4,

// Left
8, 9, 10,
10, 11, 8,

// Right
12, 13, 14,
14, 15, 12,

// Top
16, 17, 18,
18, 19, 16,

// Bottom
20, 21, 22,
22, 23, 20
};

public Cube(ShaderProgram shader) {
super("cube", shader, vertices, indices);
}
}
@@ -0,0 +1,29 @@
package kr.pe.burt.android.texture;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

private OGLView oglView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

oglView = (OGLView) findViewById(R.id.oglView);
}

@Override
protected void onPause() {
super.onPause();
oglView.onPause();
}

@Override
protected void onResume() {
super.onResume();
oglView.onResume();
}
}

0 comments on commit 99ef855

Please sign in to comment.