SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Cardboard
Android 를 위한 저렴한 VR
Youngbin Han
<sukso96100@gmail.com>
VR(Virtual Reality)?
http://blogs-images.forbes.com/danielnyegriffiths/files/2014/05/OculusRift1.jpg
https://s3.amazonaws.com/ksr/projects/476061/photo-main.jpg?1397812032
http://www.realareal.com/wp-content/uploads/2013/08/Oculus_VR_Immeractive_Haeva.jpg
$$$$$$$$
https://www.oculusvr.com/order/
g.co/cardboard
g.co/cardboard
http://www.dodocase.com/products/google-cardboard-vr-goggle-toolkit
Cardboard VR Toolkit
https://developers.google.com/cardboard/overview
Toolkit을 이용하면 다음을 포함한
많은 공통된 VR 개발을 단순화 할 수 있습니다.
● 렌즈 왜곡 보정
● 머리 추적
● 3D 교정
● 양쪽에 나란히 렌더링
● 입체 형상 구성
● 사용자 입력 이벤트 처리
간단한 Cardboard 앱 만들기.
만들기 어려운 건 함정
https://developers.google.com/cardboard/get-started
준비할 것들...
...
프로젝트에 라이브러리 추가
https://github.com/googlesamples/cardboard/blob/master/CardboardSample/libs/cardboard.jar
권장되는 Manifest.xml 설정
<manifest ...
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.VIBRATE" />
...
<uses-sdk android:minSdkVersion="16"/>
<uses-feature android:glEsVersion="0x00020000"
android:required="true" />
<application
...
<activity
android:screenOrientation="landscape"
...
</activity>
</application>
</manifest>
가로 모드
Open GL ES 사용
NFC 및
진동 권한
Android 4.1 +
CardboardActivity 상속받기
public class CardboardActivityExample
extends CardboardActivity {
…
}
CardboardView.StereoRenderer 구현하기
public class CardboardActivityExample
extends CardboardActivity implements
CardboardView.StereoRenderer {
…
}
CardboardView 초기화
private float[] mModelCube;
private float[] mCamera;
private float[] mView;
private float[] mHeadView;
private float[] mModelViewProjection;
private float[] mModelView;
private float[] mModelFloor;
private Vibrator mVibrator;
…
*
*
* Sets the view to our CardboardView and
initializes the transformation matrices we
will use
* to render our scene.
* @param savedInstanceState
*/
…
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.common_ui);
CardboardView cardboardView =
(CardboardView) findViewById(R.id.
common_paperscope_view);
// Associate a CardboardView.StereoRenderer
with cardboardView.
cardboardView.setRenderer(this);
// Associate the cardboardView with this
activity.
setCardboardView(cardboardView);
mModelCube = new float[16];
mCamera = new float[16];
mView = new float[16];
mModelViewProjection = new float[16];
mModelView = new float[16];
mModelFloor = new float[16];
mHeadView = new float[16];
mVibrator = (Vibrator) getSystemService
(Context.VIBRATOR_SERVICE);
…
}
뷰 렌더링 하기
CardboardView.StereoRenderer 를 통해 구현한,
onNewFrame(), onDrawEye() 사용.
onNewFrame() 구현하기
private int mGlProgram = GLES20.glCreateProgram();
private int mPositionParam;
private int mNormalParam;
private int mColorParam;
private int mModelViewProjectionParam;
private int mLightPosParam;
private int mModelViewParam;
private int mModelParam;
private int mIsFloorParam;
private float[] mHeadView;
...
/**
* Prepares OpenGL ES before we draw a frame.
* @param headTransform The head transformation in
the new frame.
*/
…
…
@Override
public void onNewFrame(HeadTransform headTransform) {
GLES20.glUseProgram(mGlProgram);
mModelViewProjectionParam = GLES20.
glGetUniformLocation(mGlProgram, "u_MVP");
mLightPosParam = GLES20.glGetUniformLocation
(mGlProgram, "u_LightPos");
mModelViewParam = GLES20.glGetUniformLocation
(mGlProgram, "u_MVMatrix");
mModelParam = GLES20.glGetUniformLocation
(mGlProgram, "u_Model");
mIsFloorParam = GLES20.glGetUniformLocation
(mGlProgram, "u_IsFloor");
// Build the Model part of the ModelView matrix.
Matrix.rotateM(mModelCube, 0, TIME_DELTA, 0.5f, 0.5
f, 1.0f);
// Build the camera matrix and apply it to the
ModelView.
Matrix.setLookAtM(mCamera, 0, 0.0f, 0.0f, CAMERA_Z,
0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
headTransform.getHeadView(mHeadView, 0);
checkGLError("onReadyToDraw");
}
onDrawEye() 구현하기
private int mPositionParam;
private int mNormalParam;
private int mColorParam;
// We keep the light always position
just above the user.
private final float[]
mLightPosInEyeSpace = new float[] {0.0f,
2.0f, 0.0f, 1.0f};
...
/**
* Draws a frame for an eye. The
transformation for that eye (from the
camera) is passed in as
* a parameter.
* @param transform The transformations
to apply to render this eye.
*/
…
@Override
public void onDrawEye(EyeTransform transform) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.
GL_DEPTH_BUFFER_BIT);
mPositionParam = GLES20.glGetAttribLocation(mGlProgram, "a_Position");
mNormalParam = GLES20.glGetAttribLocation(mGlProgram, "a_Normal");
mColorParam = GLES20.glGetAttribLocation(mGlProgram, "a_Color");
GLES20.glEnableVertexAttribArray(mPositionParam);
GLES20.glEnableVertexAttribArray(mNormalParam);
GLES20.glEnableVertexAttribArray(mColorParam);
checkGLError("mColorParam");
// Apply the eye transformation to the camera.
Matrix.multiplyMM(mView, 0, transform.getEyeView(), 0, mCamera, 0);
// Set the position of the light
Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 0,
mLightPosInWorldSpace, 0);
GLES20.glUniform3f(mLightPosParam, mLightPosInEyeSpace[0],
mLightPosInEyeSpace[1],
mLightPosInEyeSpace[2]);
// Build the ModelView and ModelViewProjection matrices
// for calculating cube position and light.
Matrix.multiplyMM(mModelView, 0, mView, 0, mModelCube, 0);
Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(),
0, mModelView, 0);
drawCube();
// Set mModelView for the floor, so we draw floor in the correct
location
Matrix.multiplyMM(mModelView, 0, mView, 0, mModelFloor, 0);
Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(),
0,
mModelView, 0);
...
}
자석 버튼 누름 감지하기
MagnetSensor.OnCardboardTriggerListener 사용
private Vibrator mVibrator;
private CardboardOverlayView mOverlayView;
...
/**
* Increment the score, hide the object,
and give feedback if the user pulls the
magnet while
* looking at the object. Otherwise,
remind the user what to do.
*/
@Override
public void onCardboardTrigger() {
if (isLookingAtObject()) {
mScore++;
mOverlayView.show3DToast("Found
it! Look around for another one.nScore =
" + mScore);
...
} else {
mOverlayView.show3DToast("Look
around to find the object!");
}
// Always give user feedback
mVibrator.vibrate(50);
}
/**
* Check if user is looking at object by
calculating where the object is in eye-
space.
* @return
*/
private boolean isLookingAtObject() {
float[] initVec = {0, 0, 0, 1.0f};
float[] objPositionVec = new float[4];
// Convert object space to camera
space. Use the headView from onNewFrame.
Matrix.multiplyMM(mModelView, 0,
mHeadView, 0, mModelCube, 0);
Matrix.multiplyMV(objPositionVec, 0,
mModelView, 0, initVec, 0);
float pitch = (float)Math.atan2
(objPositionVec[1], -objPositionVec[2]);
float yaw = (float)Math.atan2
(objPositionVec[0], -objPositionVec[2]);
...
return (Math.abs(pitch) < PITCH_LIMIT)
&& (Math.abs(yaw) < YAW_LIMIT);
}
Cardboard 앱 시연
(예제 앱) Treasure Hunt
Cardboard Demo 앱
참고자료
● https://developers.google.com/cardboard/get-started
● g.co/cardboard
● http://www.khronos.org/opengles/sdk/docs/man/
Thank You!

Weitere ähnliche Inhalte

Andere mochten auch

Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합
Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합
Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합Youngbin Han
 
[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규
[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규
[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규ChangKyu Song
 
2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디
2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디
2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디Youngbin Han
 
0.Before Get Started - 시온고등학교 안드로이드 스터디
0.Before Get Started - 시온고등학교 안드로이드 스터디0.Before Get Started - 시온고등학교 안드로이드 스터디
0.Before Get Started - 시온고등학교 안드로이드 스터디Youngbin Han
 
우분투 12.04 편법으로 외장하드에 설치해보기
우분투 12.04 편법으로 외장하드에 설치해보기우분투 12.04 편법으로 외장하드에 설치해보기
우분투 12.04 편법으로 외장하드에 설치해보기Youngbin Han
 
1.Create Project Sunshine - 시온고등학교 안드로이드 스터디
1.Create Project Sunshine - 시온고등학교 안드로이드 스터디1.Create Project Sunshine - 시온고등학교 안드로이드 스터디
1.Create Project Sunshine - 시온고등학교 안드로이드 스터디Youngbin Han
 
제2회 SSSCON - 웹해킹 스터디 현황
제2회 SSSCON - 웹해킹 스터디 현황제2회 SSSCON - 웹해킹 스터디 현황
제2회 SSSCON - 웹해킹 스터디 현황Youngbin Han
 
4년치 컨닝페이퍼
4년치 컨닝페이퍼4년치 컨닝페이퍼
4년치 컨닝페이퍼totodeung
 
2016 D.LAB Recruit 160713
2016 D.LAB Recruit 1607132016 D.LAB Recruit 160713
2016 D.LAB Recruit 160713영광 송
 
한글시계웍샵_SW
한글시계웍샵_SW한글시계웍샵_SW
한글시계웍샵_SW영광 송
 
[NDC2014] 반응적 라이브 개발
[NDC2014] 반응적 라이브 개발[NDC2014] 반응적 라이브 개발
[NDC2014] 반응적 라이브 개발ChangKyu Song
 
[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규
[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규
[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규ChangKyu Song
 
Windows system - memory개념잡기
Windows system - memory개념잡기Windows system - memory개념잡기
Windows system - memory개념잡기ChangKyu Song
 
개발자들 오리엔테이션
개발자들 오리엔테이션개발자들 오리엔테이션
개발자들 오리엔테이션Park JoongSoo
 
모바일앱 개발에서 개발자가 알아야할 팁
모바일앱 개발에서 개발자가 알아야할 팁모바일앱 개발에서 개발자가 알아야할 팁
모바일앱 개발에서 개발자가 알아야할 팁James (SeokHun) Hwang
 
린 소프트웨어 개발(Lean software development)
린 소프트웨어 개발(Lean software development)린 소프트웨어 개발(Lean software development)
린 소프트웨어 개발(Lean software development)영기 김
 
칸반(Kanban)
칸반(Kanban)칸반(Kanban)
칸반(Kanban)영기 김
 
JSP 빠르게 시작하기
JSP 빠르게 시작하기JSP 빠르게 시작하기
JSP 빠르게 시작하기Park JoongSoo
 

Andere mochten auch (20)

Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합
Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합
Git&GitHub 를 이용한 버전관리와 협업 - 4.협업과 지속적 통합
 
[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규
[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규
[NDC10] Unity Build 로 빌드타임 반토막내기 - 송창규
 
2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디
2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디
2.Connect Sunshine to the Cloud - 시온고 안드로이드 스터디
 
0.Before Get Started - 시온고등학교 안드로이드 스터디
0.Before Get Started - 시온고등학교 안드로이드 스터디0.Before Get Started - 시온고등학교 안드로이드 스터디
0.Before Get Started - 시온고등학교 안드로이드 스터디
 
우분투 12.04 편법으로 외장하드에 설치해보기
우분투 12.04 편법으로 외장하드에 설치해보기우분투 12.04 편법으로 외장하드에 설치해보기
우분투 12.04 편법으로 외장하드에 설치해보기
 
1.Create Project Sunshine - 시온고등학교 안드로이드 스터디
1.Create Project Sunshine - 시온고등학교 안드로이드 스터디1.Create Project Sunshine - 시온고등학교 안드로이드 스터디
1.Create Project Sunshine - 시온고등학교 안드로이드 스터디
 
제2회 SSSCON - 웹해킹 스터디 현황
제2회 SSSCON - 웹해킹 스터디 현황제2회 SSSCON - 웹해킹 스터디 현황
제2회 SSSCON - 웹해킹 스터디 현황
 
02.모의해킹전문가되기
02.모의해킹전문가되기02.모의해킹전문가되기
02.모의해킹전문가되기
 
4년치 컨닝페이퍼
4년치 컨닝페이퍼4년치 컨닝페이퍼
4년치 컨닝페이퍼
 
2016 D.LAB Recruit 160713
2016 D.LAB Recruit 1607132016 D.LAB Recruit 160713
2016 D.LAB Recruit 160713
 
한글시계웍샵_SW
한글시계웍샵_SW한글시계웍샵_SW
한글시계웍샵_SW
 
[NDC2014] 반응적 라이브 개발
[NDC2014] 반응적 라이브 개발[NDC2014] 반응적 라이브 개발
[NDC2014] 반응적 라이브 개발
 
[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규
[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규
[NDC13] 70명이 커밋하는 라이브 개발하기 (해외 진출 라이브 프로젝트의 개발 관리) - 송창규
 
Windows system - memory개념잡기
Windows system - memory개념잡기Windows system - memory개념잡기
Windows system - memory개념잡기
 
What is agile
What is agileWhat is agile
What is agile
 
개발자들 오리엔테이션
개발자들 오리엔테이션개발자들 오리엔테이션
개발자들 오리엔테이션
 
모바일앱 개발에서 개발자가 알아야할 팁
모바일앱 개발에서 개발자가 알아야할 팁모바일앱 개발에서 개발자가 알아야할 팁
모바일앱 개발에서 개발자가 알아야할 팁
 
린 소프트웨어 개발(Lean software development)
린 소프트웨어 개발(Lean software development)린 소프트웨어 개발(Lean software development)
린 소프트웨어 개발(Lean software development)
 
칸반(Kanban)
칸반(Kanban)칸반(Kanban)
칸반(Kanban)
 
JSP 빠르게 시작하기
JSP 빠르게 시작하기JSP 빠르게 시작하기
JSP 빠르게 시작하기
 

Ähnlich wie Cardboard : Android 를 위한 저렴한 VR

Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLgerbille
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGLTony Parisi
 
Ujug07presentation
Ujug07presentationUjug07presentation
Ujug07presentationBill Adams
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScriptersgerbille
 
Hacking Reality: Browser-Based VR with HTML5
Hacking Reality: Browser-Based VR with HTML5Hacking Reality: Browser-Based VR with HTML5
Hacking Reality: Browser-Based VR with HTML5Tony Parisi
 
Making Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
Making Games in WebGL - Aro Wierzbowski & Tomasz SzepczyńskiMaking Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
Making Games in WebGL - Aro Wierzbowski & Tomasz SzepczyńskiGrand Parade Poland
 
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony ParisiWT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony ParisiAMD Developer Central
 
Virtual Reality in Android
Virtual Reality in AndroidVirtual Reality in Android
Virtual Reality in AndroidMario Bodemann
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DRoman Protsyk
 
WebGL, HTML5 and How the Mobile Web Was Won
WebGL, HTML5 and How the Mobile Web Was WonWebGL, HTML5 and How the Mobile Web Was Won
WebGL, HTML5 and How the Mobile Web Was WonTony Parisi
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceBo-Yi Wu
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Techvincent_scheib
 
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhonejonmarimba
 
3D Programming Basics: WebGL
3D Programming Basics: WebGL3D Programming Basics: WebGL
3D Programming Basics: WebGLGlobant
 
Introduction to WebGL and WebVR
Introduction to WebGL and WebVRIntroduction to WebGL and WebVR
Introduction to WebGL and WebVRDaosheng Mu
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Librarynaohito maeda
 
Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016Tony Parisi
 

Ähnlich wie Cardboard : Android 를 위한 저렴한 VR (20)

WebVR - JAX 2016
WebVR -  JAX 2016WebVR -  JAX 2016
WebVR - JAX 2016
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGL
 
Ujug07presentation
Ujug07presentationUjug07presentation
Ujug07presentation
 
FLAR Workflow
FLAR WorkflowFLAR Workflow
FLAR Workflow
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 
Hacking Reality: Browser-Based VR with HTML5
Hacking Reality: Browser-Based VR with HTML5Hacking Reality: Browser-Based VR with HTML5
Hacking Reality: Browser-Based VR with HTML5
 
Making Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
Making Games in WebGL - Aro Wierzbowski & Tomasz SzepczyńskiMaking Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
Making Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
 
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony ParisiWT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
WT-4064, Build Rich Applications with HTML5 and WebGL, by Tony Parisi
 
Virtual Reality in Android
Virtual Reality in AndroidVirtual Reality in Android
Virtual Reality in Android
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3D
 
WebGL, HTML5 and How the Mobile Web Was Won
WebGL, HTML5 and How the Mobile Web Was WonWebGL, HTML5 and How the Mobile Web Was Won
WebGL, HTML5 and How the Mobile Web Was Won
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript Conference
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
 
3D Programming Basics: WebGL
3D Programming Basics: WebGL3D Programming Basics: WebGL
3D Programming Basics: WebGL
 
Introduction to WebGL and WebVR
Introduction to WebGL and WebVRIntroduction to WebGL and WebVR
Introduction to WebGL and WebVR
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Library
 
Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016
 
iOS OpenGL
iOS OpenGLiOS OpenGL
iOS OpenGL
 

Mehr von Youngbin Han

Ubucon Europe and Asia
Ubucon Europe and AsiaUbucon Europe and Asia
Ubucon Europe and AsiaYoungbin Han
 
우분투 아시아 컨퍼런스 바닥에서 시작하기
우분투 아시아 컨퍼런스 바닥에서 시작하기우분투 아시아 컨퍼런스 바닥에서 시작하기
우분투 아시아 컨퍼런스 바닥에서 시작하기Youngbin Han
 
Automating boring and repetitive UbuCon Asia video and subtitle stuffs
Automating boring and repetitive UbuCon Asia video and subtitle stuffsAutomating boring and repetitive UbuCon Asia video and subtitle stuffs
Automating boring and repetitive UbuCon Asia video and subtitle stuffsYoungbin Han
 
Engaging new l10n contributors through Open Source Contributhon
Engaging new l10n contributors through Open Source ContributhonEngaging new l10n contributors through Open Source Contributhon
Engaging new l10n contributors through Open Source ContributhonYoungbin Han
 
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)Youngbin Han
 
What's new in Ubuntu 18.04 LTS
What's new in Ubuntu 18.04 LTSWhat's new in Ubuntu 18.04 LTS
What's new in Ubuntu 18.04 LTSYoungbin Han
 
Naver Campus Hackday Winter 2017 참가 후기
Naver Campus Hackday Winter 2017 참가 후기Naver Campus Hackday Winter 2017 참가 후기
Naver Campus Hackday Winter 2017 참가 후기Youngbin Han
 
우분투한국커뮤니티 2017년 활동보고
우분투한국커뮤니티 2017년 활동보고우분투한국커뮤니티 2017년 활동보고
우분투한국커뮤니티 2017년 활동보고Youngbin Han
 
FluxSync Team 중간보고
FluxSync Team 중간보고FluxSync Team 중간보고
FluxSync Team 중간보고Youngbin Han
 
openSUSE.Asia Summit 2017 Tokyo 참관후기
openSUSE.Asia Summit 2017 Tokyo 참관후기openSUSE.Asia Summit 2017 Tokyo 참관후기
openSUSE.Asia Summit 2017 Tokyo 참관후기Youngbin Han
 
How & Why we have connected Slack & IRC
How & Why we have connected Slack & IRCHow & Why we have connected Slack & IRC
How & Why we have connected Slack & IRCYoungbin Han
 
SKHUFEEDS 소개 발표자료(노트 포함)
SKHUFEEDS 소개 발표자료(노트 포함)SKHUFEEDS 소개 발표자료(노트 포함)
SKHUFEEDS 소개 발표자료(노트 포함)Youngbin Han
 
SKHUFEEDS 소개 발표자료
SKHUFEEDS 소개 발표자료SKHUFEEDS 소개 발표자료
SKHUFEEDS 소개 발표자료Youngbin Han
 
Snaps on Ubuntu Desktop
Snaps on Ubuntu DesktopSnaps on Ubuntu Desktop
Snaps on Ubuntu DesktopYoungbin Han
 
How and why we have integrated Slack and IRC
How and why we have integrated Slack and IRCHow and why we have integrated Slack and IRC
How and why we have integrated Slack and IRCYoungbin Han
 
Ubuntu's Unity - Birth to Death(in 5minutes)
Ubuntu's Unity - Birth to Death(in 5minutes)Ubuntu's Unity - Birth to Death(in 5minutes)
Ubuntu's Unity - Birth to Death(in 5minutes)Youngbin Han
 
Jekyll and GitHub Pages
Jekyll and GitHub PagesJekyll and GitHub Pages
Jekyll and GitHub PagesYoungbin Han
 
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기Youngbin Han
 
Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기
Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기
Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기Youngbin Han
 
Node.js 런타임 버전 관리하기
Node.js 런타임 버전 관리하기Node.js 런타임 버전 관리하기
Node.js 런타임 버전 관리하기Youngbin Han
 

Mehr von Youngbin Han (20)

Ubucon Europe and Asia
Ubucon Europe and AsiaUbucon Europe and Asia
Ubucon Europe and Asia
 
우분투 아시아 컨퍼런스 바닥에서 시작하기
우분투 아시아 컨퍼런스 바닥에서 시작하기우분투 아시아 컨퍼런스 바닥에서 시작하기
우분투 아시아 컨퍼런스 바닥에서 시작하기
 
Automating boring and repetitive UbuCon Asia video and subtitle stuffs
Automating boring and repetitive UbuCon Asia video and subtitle stuffsAutomating boring and repetitive UbuCon Asia video and subtitle stuffs
Automating boring and repetitive UbuCon Asia video and subtitle stuffs
 
Engaging new l10n contributors through Open Source Contributhon
Engaging new l10n contributors through Open Source ContributhonEngaging new l10n contributors through Open Source Contributhon
Engaging new l10n contributors through Open Source Contributhon
 
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
Introduction to Hanjp-IM Project (DebConf18 - Hsinchu, Taiwan)
 
What's new in Ubuntu 18.04 LTS
What's new in Ubuntu 18.04 LTSWhat's new in Ubuntu 18.04 LTS
What's new in Ubuntu 18.04 LTS
 
Naver Campus Hackday Winter 2017 참가 후기
Naver Campus Hackday Winter 2017 참가 후기Naver Campus Hackday Winter 2017 참가 후기
Naver Campus Hackday Winter 2017 참가 후기
 
우분투한국커뮤니티 2017년 활동보고
우분투한국커뮤니티 2017년 활동보고우분투한국커뮤니티 2017년 활동보고
우분투한국커뮤니티 2017년 활동보고
 
FluxSync Team 중간보고
FluxSync Team 중간보고FluxSync Team 중간보고
FluxSync Team 중간보고
 
openSUSE.Asia Summit 2017 Tokyo 참관후기
openSUSE.Asia Summit 2017 Tokyo 참관후기openSUSE.Asia Summit 2017 Tokyo 참관후기
openSUSE.Asia Summit 2017 Tokyo 참관후기
 
How & Why we have connected Slack & IRC
How & Why we have connected Slack & IRCHow & Why we have connected Slack & IRC
How & Why we have connected Slack & IRC
 
SKHUFEEDS 소개 발표자료(노트 포함)
SKHUFEEDS 소개 발표자료(노트 포함)SKHUFEEDS 소개 발표자료(노트 포함)
SKHUFEEDS 소개 발표자료(노트 포함)
 
SKHUFEEDS 소개 발표자료
SKHUFEEDS 소개 발표자료SKHUFEEDS 소개 발표자료
SKHUFEEDS 소개 발표자료
 
Snaps on Ubuntu Desktop
Snaps on Ubuntu DesktopSnaps on Ubuntu Desktop
Snaps on Ubuntu Desktop
 
How and why we have integrated Slack and IRC
How and why we have integrated Slack and IRCHow and why we have integrated Slack and IRC
How and why we have integrated Slack and IRC
 
Ubuntu's Unity - Birth to Death(in 5minutes)
Ubuntu's Unity - Birth to Death(in 5minutes)Ubuntu's Unity - Birth to Death(in 5minutes)
Ubuntu's Unity - Birth to Death(in 5minutes)
 
Jekyll and GitHub Pages
Jekyll and GitHub PagesJekyll and GitHub Pages
Jekyll and GitHub Pages
 
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
 
Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기
Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기
Git&GitHub 를 이용한 버전관리와 협업 - 1.첫 커밋 푸시하기
 
Node.js 런타임 버전 관리하기
Node.js 런타임 버전 관리하기Node.js 런타임 버전 관리하기
Node.js 런타임 버전 관리하기
 

Kürzlich hochgeladen

WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 

Kürzlich hochgeladen (20)

WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

Cardboard : Android 를 위한 저렴한 VR

  • 1. Cardboard Android 를 위한 저렴한 VR Youngbin Han <sukso96100@gmail.com>
  • 11.
  • 12.
  • 13.
  • 14.
  • 16. Toolkit을 이용하면 다음을 포함한 많은 공통된 VR 개발을 단순화 할 수 있습니다. ● 렌즈 왜곡 보정 ● 머리 추적 ● 3D 교정 ● 양쪽에 나란히 렌더링 ● 입체 형상 구성 ● 사용자 입력 이벤트 처리
  • 17. 간단한 Cardboard 앱 만들기. 만들기 어려운 건 함정 https://developers.google.com/cardboard/get-started
  • 20. 권장되는 Manifest.xml 설정 <manifest ... <uses-permission android:name="android.permission.NFC" /> <uses-permission android:name="android.permission.VIBRATE" /> ... <uses-sdk android:minSdkVersion="16"/> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <application ... <activity android:screenOrientation="landscape" ... </activity> </application> </manifest> 가로 모드 Open GL ES 사용 NFC 및 진동 권한 Android 4.1 +
  • 21. CardboardActivity 상속받기 public class CardboardActivityExample extends CardboardActivity { … }
  • 22. CardboardView.StereoRenderer 구현하기 public class CardboardActivityExample extends CardboardActivity implements CardboardView.StereoRenderer { … }
  • 24. private float[] mModelCube; private float[] mCamera; private float[] mView; private float[] mHeadView; private float[] mModelViewProjection; private float[] mModelView; private float[] mModelFloor; private Vibrator mVibrator; … * * * Sets the view to our CardboardView and initializes the transformation matrices we will use * to render our scene. * @param savedInstanceState */ … @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.common_ui); CardboardView cardboardView = (CardboardView) findViewById(R.id. common_paperscope_view); // Associate a CardboardView.StereoRenderer with cardboardView. cardboardView.setRenderer(this); // Associate the cardboardView with this activity. setCardboardView(cardboardView); mModelCube = new float[16]; mCamera = new float[16]; mView = new float[16]; mModelViewProjection = new float[16]; mModelView = new float[16]; mModelFloor = new float[16]; mHeadView = new float[16]; mVibrator = (Vibrator) getSystemService (Context.VIBRATOR_SERVICE); … }
  • 25. 뷰 렌더링 하기 CardboardView.StereoRenderer 를 통해 구현한, onNewFrame(), onDrawEye() 사용.
  • 26. onNewFrame() 구현하기 private int mGlProgram = GLES20.glCreateProgram(); private int mPositionParam; private int mNormalParam; private int mColorParam; private int mModelViewProjectionParam; private int mLightPosParam; private int mModelViewParam; private int mModelParam; private int mIsFloorParam; private float[] mHeadView; ... /** * Prepares OpenGL ES before we draw a frame. * @param headTransform The head transformation in the new frame. */ … … @Override public void onNewFrame(HeadTransform headTransform) { GLES20.glUseProgram(mGlProgram); mModelViewProjectionParam = GLES20. glGetUniformLocation(mGlProgram, "u_MVP"); mLightPosParam = GLES20.glGetUniformLocation (mGlProgram, "u_LightPos"); mModelViewParam = GLES20.glGetUniformLocation (mGlProgram, "u_MVMatrix"); mModelParam = GLES20.glGetUniformLocation (mGlProgram, "u_Model"); mIsFloorParam = GLES20.glGetUniformLocation (mGlProgram, "u_IsFloor"); // Build the Model part of the ModelView matrix. Matrix.rotateM(mModelCube, 0, TIME_DELTA, 0.5f, 0.5 f, 1.0f); // Build the camera matrix and apply it to the ModelView. Matrix.setLookAtM(mCamera, 0, 0.0f, 0.0f, CAMERA_Z, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); headTransform.getHeadView(mHeadView, 0); checkGLError("onReadyToDraw"); }
  • 27. onDrawEye() 구현하기 private int mPositionParam; private int mNormalParam; private int mColorParam; // We keep the light always position just above the user. private final float[] mLightPosInEyeSpace = new float[] {0.0f, 2.0f, 0.0f, 1.0f}; ... /** * Draws a frame for an eye. The transformation for that eye (from the camera) is passed in as * a parameter. * @param transform The transformations to apply to render this eye. */ … @Override public void onDrawEye(EyeTransform transform) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20. GL_DEPTH_BUFFER_BIT); mPositionParam = GLES20.glGetAttribLocation(mGlProgram, "a_Position"); mNormalParam = GLES20.glGetAttribLocation(mGlProgram, "a_Normal"); mColorParam = GLES20.glGetAttribLocation(mGlProgram, "a_Color"); GLES20.glEnableVertexAttribArray(mPositionParam); GLES20.glEnableVertexAttribArray(mNormalParam); GLES20.glEnableVertexAttribArray(mColorParam); checkGLError("mColorParam"); // Apply the eye transformation to the camera. Matrix.multiplyMM(mView, 0, transform.getEyeView(), 0, mCamera, 0); // Set the position of the light Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 0, mLightPosInWorldSpace, 0); GLES20.glUniform3f(mLightPosParam, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1], mLightPosInEyeSpace[2]); // Build the ModelView and ModelViewProjection matrices // for calculating cube position and light. Matrix.multiplyMM(mModelView, 0, mView, 0, mModelCube, 0); Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(), 0, mModelView, 0); drawCube(); // Set mModelView for the floor, so we draw floor in the correct location Matrix.multiplyMM(mModelView, 0, mView, 0, mModelFloor, 0); Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(), 0, mModelView, 0); ... }
  • 28. 자석 버튼 누름 감지하기 MagnetSensor.OnCardboardTriggerListener 사용
  • 29. private Vibrator mVibrator; private CardboardOverlayView mOverlayView; ... /** * Increment the score, hide the object, and give feedback if the user pulls the magnet while * looking at the object. Otherwise, remind the user what to do. */ @Override public void onCardboardTrigger() { if (isLookingAtObject()) { mScore++; mOverlayView.show3DToast("Found it! Look around for another one.nScore = " + mScore); ... } else { mOverlayView.show3DToast("Look around to find the object!"); } // Always give user feedback mVibrator.vibrate(50); } /** * Check if user is looking at object by calculating where the object is in eye- space. * @return */ private boolean isLookingAtObject() { float[] initVec = {0, 0, 0, 1.0f}; float[] objPositionVec = new float[4]; // Convert object space to camera space. Use the headView from onNewFrame. Matrix.multiplyMM(mModelView, 0, mHeadView, 0, mModelCube, 0); Matrix.multiplyMV(objPositionVec, 0, mModelView, 0, initVec, 0); float pitch = (float)Math.atan2 (objPositionVec[1], -objPositionVec[2]); float yaw = (float)Math.atan2 (objPositionVec[0], -objPositionVec[2]); ... return (Math.abs(pitch) < PITCH_LIMIT) && (Math.abs(yaw) < YAW_LIMIT); }
  • 30. Cardboard 앱 시연 (예제 앱) Treasure Hunt Cardboard Demo 앱