보관물

Posts Tagged ‘openGLES’

Getting Started with Graphics and Animation

2월 18, 2011 댓글 남기기

iOS는 graphics와 animation을 실행하기위해 3가지  framework를 지원한다.

  • UIKit
    Objective-C class library.
    UI 제어, Animate, 2D drawing
  • Core Graphics
    C-Based API.
    Vector graphics, Bitmap images, PDF content
    (Quartz 2D는 2D drawing engine으로 사용되며 종종 Core Graphics와 동의어로 사용됨)
  • OpenGL ES
    Objective-C based API로 구현한 EAGL을 사용
    2D/3D drawing

The Basics

View Programming Guide for iOS
Drawing and Printing Guide for iOS

Deciding Which Frameworks to Use

Drawing Layered Content

Metronome 예제 참조
UIView Class Reference

Animating

MoveMe 예제 참조
Animations
Core Animation Programming Guide

Working With Images

UIImageView Class Reference
UIImage Class Reference
UIScrollView Class Reference
UIScrollViewDelegate Protocol Reference

Drawing Custom Content using Quartz 2D

Drawing and Printing Guide for iOS
CGContext Reference
Overview of Quartz 2D
Quartz 2D Programming Guide

Drawing With OpenGL ES

GLSprite 예제
OpenGL ES Overview
OpenGL ES Programming Guide for iOS

원본자료

Getting Started with Graphics and Animation

openGL

2월 17, 2011 댓글 남기기

2D graphics

  • Bitmaps : pixel에 대응하는 RGBA값으로 표현
    (확대/축소시 quality에 변화가 생김)
  • Vector : point와의 관계를 line, curve 등으로 표현
    (확대/축소시 quality에 변화가 상대적으로 적음)

Bitmaps

화면크기는 320 * 480 (iPhone 3GS기준)
320 * 480 bitmap image는 320 * 480 * 4(RGBA) = 614,400 byte를 사용 (비압축시)
참고로 iPad의 경우 화면크기가 768*1024 이므로 3,145,728 byte를 사용하게 됨

GL Function Naming Convention

“library” + “command” + “number of args” + “type of arg”
“library” + “command” +” type of arg”
“library” + “command”

ex) glColor3f (..)

gl : openGL library
Color : command
3 : number of args
f : type of arg

ex) glRectf (..)

gl : openGL library
Rect : command
f : type of arg

ex) glFlush ()

gl : openGL library
Flush : command

Draw Point

점 A1 (x1, y1, z1)을 그림.

glBegin (GL_POINTS);
glVertex3f (x1, y1, z1);
glEnd();

Draw Lines

점  A1 (x1, y1, z1)과 점 A2 (x2, y2, z2)를 끝점으로 하는 line을 그림.
또한 점 A3와 점 A4를 끝점으로 하는 line을 그림.

glBegin(GL_LINES);
glVertex3f (x1, y1, z1);
glVertex3f (x2, y2, z2);
glVertex3f (x3, y3, z3);
glVertex3f (x4, y4, z4);
glEnd();

그렇다면 선 A1A2, 선 A2A3, 선 A3A4를 연속으로 그리려면?

glBegin (GL_LINE_STRIP);

위의 예에서 GL_LINES를 GL_LINE_STRIP으로 변경하면 됨.

<<To be continued…>>

참조자료

Introduction to OpenGL and 3D Graphics

카테고리:openGL ES 태그:,