OpenGL ES에 공부를 하면서 글을 작성하려고 했는데 제대로 이해를 하지 못해서 바로 작성이 어려울 것 같다. 그래서 계속 공부하면서 예제 파일을 정리해서 올릴 계획이다. 아래 파일은 모두 출처 1의 “Getting Started Section”의 코드를 GLES 버전으로 변경한 코드이다. 삼성 갤럭시 9 제품에서 정상적으로 동작하는 것을 확인한 코드이다.
예제 코드 사이트 정리
- Getting Started Section 예제 코드: https://mkblog.co.kr/2018/10/14/opengl-es-getting-started-section-example-code/
- Lighting Section 예제 코드: https://mkblog.co.kr/2018/11/08/opengl-es-lighting-section-example-code/
GLES Getting Started Section 예제 코드 정리
- Window Example
- (Ch5) Triangle Example: 삼각형 1개 그리는 예제 코드
- (Ch5) EBO Triangle Example: Element Buffer Object (EBO) 사용하여 삼각형 2개 그리는 예제 코드
- (Ch5 Exercise 1) Two Triangles Example: 추가 좌표를 사용하여 삼각형 그리는 예제 코드
- (Ch5 Exercise 2) Two VAO VBO Example: 두개의 Vertex Array Object (VAO), Vertex Buffer Object (VBO)를 사용하여 삼각형을 그리는 예제 코드
- (Ch5 Exercise 3) Two Fragment Shader Example: 두개의 다른 Fragment Shader을 사용하여 삼각형 그리는 예제 코드
- (Ch6) Shader In/Out Example: Shader 코드에 In/Out 사용하여 Color 변경하는 예제 코드
- (Ch6) Uniform Example: Uniform 사용하여 Color 변경하는 예제 코드
- (Ch6) Color Interpolation Example: Color Interpolation 사용하여 Color 변경하는 예제 코드
- (Ch6) Own Shader Class Example: Shader Code Compile Class 예제 코드
- (Ch6 Exercise 1) Upside Down Triangle Example: Vertex Shader 코드 변경하여 Triangle 방향 변경하는 예제 코드
- (Ch6 Exercise 2) Uniform Offset Example: Uniform Offset 사용하여 삼각형 위치 변경하는 예제 코드
- (Ch6 Exercise 3) Vertex Position as Output Color Example: Vertex Position 값을 사용하여 Fragment 색상 결정하는 예제 코드
- (Ch7) Texture Example: Texture와 색상을 동시에 사용하는 예제 코드
- (Ch7) Multiple Texture Example: 여러개의 Texture를 사용하는 예제 코드
- (Ch7 Exercise 1) Texture Reverse Example: Fragment 코드에서 Texture 반대로 그리는 예제 코드
- (Ch7 Exercise 2) Four Smile Textures: 4개의 Texture을 반복해서 그리는 예제 코드
- (Ch7 Exercise 3) Closer Look on Texture Image: Texture Coordinate를 변경하여 Texture를 가깝게 보이도록 변경한 예제 코드
- (Ch7 Exercise 4) Mix Textures: Up/Down 터치를 통해서 Texture Mix 값을 달리하는 예제 코드
- (Ch8) Rotated Box: Texture Box를 90도 회전하고 사이즈 절반으로 줄이는 예제 코드
- (Ch8) Rotating Box: Texture Box가 회전하는 코드 예제
- (Ch8 Exercise 1) Rotating Box Around Center Position: Center을 기준으로 박스가 회전하는 코드 예제 (Rotating Matrix와 Translating Matrix 연산 순서를 바꾼 경우)
- (Ch8 Exercise 2) Two Texture Boxes: 2개의 Texture 박스를 그리는 예제 (1개는 Rotating하고, 다른 한개는 시간에 지남에 따라 작아짐)
- (Ch9) Lay Down Box: 박스 모양의 사각형이 3D 형태로 보이도록 변경한 코드
- (Ch9) Rotating 3D Cube: Rotating하는 3D Cube
- (Ch9) Multiple Cubes: 여러개의 Cube를 보여주는 코드
- (Ch9 Exercise 1) Varying Field of View (FoV): FoV를 실시간으로 변경하여 이미지를 그리는 코드
- (Ch9 Exercise 1) Varying Aspect-Ratio: Aspect Ratio를 변경하여 이미지를 그리는 예제 코드
- (Ch9 Exercise 2) Matrix Translating: Matrix Translating연산에 따른 이미지 변화 예제 코드
- (Ch9 Exercise 3) Rotating Multiple Cubes: 0, 3, 6, 9 번째 Cube를 Rotating하는 예제 코드
- (Ch10) Look At: 3D Cube가 카메라를 중심으로 돌아가는 예제 코드
- (Ch10) Walk Around: Touch를 사용하여 Cube 주위를 돌아다니는 예제 코드
- (Ch10) Movement Speed: 단말에 따라 비슷한 속도로 Cube 주위를 움직이는 예제 코드
- (Ch10) Multiple Touch Event: Touch하는 손가락의 개수에 따라 Angle, Location, Zoom을 달리하는 예제 코드
출처
- https://learnopengl.com/
- https://developer.android.com/training/graphics/opengl/touch
- http://www.digikey.tw/Web%20Export/Supplier%20Content/invensense-1428/pdf/invensense-making-android-3d-graphics.pdf