SSISO Community 
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분
회원가입 I 비밀번호 찾기

회원: 1명 카페짱: ssiso10 클럽생성일: 2012-01-26 11:58:10
안드로이드(android)

공지사항 및 게시판
사진게시판
SSISO Community카페
OPEN GL ES
이름
제목
패스워드
HTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.example.RubikCubeAnimationExample;
 
public class M4 {
public float[][] m = new float[4][4];
 
public M4() {
}
 
public M4(M4 other) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
m[i][j] = other.m[i][j];
}
}
}
 
public void multiply(GLVertex src, GLVertex dest) {
dest.x = src.x * m[0][0] + src.y * m[1][0] + src.z * m[2][0] + m[3][0];
dest.y = src.x * m[0][1] + src.y * m[1][1] + src.z * m[2][1] + m[3][1];
dest.z = src.x * m[0][2] + src.y * m[1][2] + src.z * m[2][2] + m[3][2];
}
 
public M4 multiply(M4 other) {
M4 result = new M4();
float[][] m1 = m;
float[][] m2 = other.m;
 
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
result.m[i][j] = m1[i][0]*m2[0][j] + m1[i][1]*m2[1][j] + m1[i][2]*m2[2][j] + m1[i][3]*m2[3][j];
}
}
 
return result;
}
 
public void setIdentity() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
m[i][j] = (i == j ? 1f : 0f);
}
}
}
 
@Override
public String toString() {
StringBuilder builder = new StringBuilder("[ ");
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
builder.append(m[i][j]);
builder.append(" ");
}
if (i < 2)
builder.append("n ");
}
builder.append(" ]");
return builder.toString();
}
}

 

 

3.) Create and write following into src/Layer.java:

 

 

 

4.) Create and write following into src/KubeRenderer.java:

 

 

 

5.) Create and write following into src/GLWorld.java:

 

 

 

6.) Create and write following into src/GLVertex.java:

 

 

 

7.) Create and write following into src/GLShape.java:

 

 

 

8.) Create and write following into src/GLFace.java:

 

 

 

10.) Create and write following into src/Cube.java:

 

 

 

11.) Run for output.

Steps:

1.) Create a project named RubikCubeAnimationExample and set the information as stated in the image.

Build Target: Android 4.0
Application Name: RubikCubeAnimationExample
Package Name: com. example. RubikCubeAnimationExample
Activity Name: RubikCubeAnimationExampleActivity
Min SDK Version: 14

2.) Open RubikCubeAnimationExampleActivity.java file and write following code there:

 

 

 

3.) Compile and build the project.

Output

사진첨부
 
 

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.