[OpenGL] 기본 draw 동작 (ES1.1/2.0)

  [출처] [OpenGL] 기본 draw 동작 (ES1.1/2.0)|작성자 글쎄  


OpenGL ES 1.1


1. 버퍼를 지운다.

 - glClearColor로 지울 color을 지정하고

 - glClear로 버퍼를 지운다.


2. 위치, 색상 속성을 활성화 한다.

 - glEnableClientState(GL_VERTEX_ARRAY 또는 GL_COLOR_ARRAY)


3. OpenGL에서 위치, 색상 속성을 가져오는 방법을 정의한다.

 - glVertexPointer : 위치 정보를 가져오는 방법을 정의

 - glColorPointer : 색상 정보를 정보를 가져오는 방법을 정의 


4. 그린다. 버퍼를 렌더링한다.

 - glDrawArrays

 - 3에서 glVertexPointer, glColorPointer에 정의된 방법으로 위치, 색상 정보를 가져와서 그리기를 수행한다.


5. 위치, 색상 속성을 비활성화한다.

 - vertex, color 속성의 경우에는 그리기 명령이 수행되는 동안만 활성화 시켜야한다.

 - glDisableClientState(GL_VERTEX_ARRAY 또는 GL_COLOR_ARRAY)


6. 4에서 렌더링된 버퍼를 화면에 그린다.

 - OpenGL 컨텍스트에서 처리 (iOS는 EAGLContext의 presentRenderbuffer)





OpenGL ES 2.0


1. 버퍼를 지운다.

 - glClearColor로 지울 color을 지정하고

 - glClear로 버퍼를 지운다.


2. Shader 정보를 얻어옴
 - shader에 입력될 vertex(position), color 정보(pointer, slot)를 얻어옴
 - glGetAttribLocation

3. 2에서 얻어온 Shader 정보(slot)을 활성화
 - glEnableVertexAttribArray

4. OpenGL의 Shader에서 위치, 색상 속성을 가져오는 방법을 정의한다.

 - glVertexAttribPointer


5. 그린다. 버퍼를 렌더링한다.

 - glDrawArrays

 - 4에서 정의된 방법으로 위치, 색상 정보를 가져와서 그리기를 수행한다.


6. 2에서 얻어온 Shader 정보(slot)을 비활성화

 - glDisableVertexAttribArray

by 재환이아빠 | 2012/04/03 12:17 | opengl-es | 트랙백 | 덧글(0)

이미지영상처리

http://www.donghuna.com/30

by 재환이아빠 | 2011/12/07 15:50 | 기타 | 트랙백 | 덧글(0)

Cocoa 아이폰 개발 - Custom Font 사용하기

출처: http://suigui.com/3017792


이 방법은 iPhone/iPad SDK 3.2부터 지원되고.. 너무 간단합니다 :>

  • 프로젝트의 info.plist에 key로 UIAppFonts 를 추가하고 
  • array로 변경해서 Item X에 font 이름 쓰기
  • font화일을 프로젝트에 resource로 추가
  • font화일 오른쪽 클릭해서 '정보 입수'로 폰트 이름 확인

  • 아래 코드를 돌려보면 등록된 폰트 이름이 보이고, 이제 그냥 시스템 폰트처럼 사용하면 됩니다.
  • 화일 이름이 아니고, 위에서 확인한 폰트 이름으로 사용해야 합니다. :>
  • 혹시 UIAppFonts에 등록된 폰트가 로딩에 문제가 있으면, 디버거 콘솔창에 뭔가 출력될 겁니다~
  • cocos2d 등에서도 그냥 사용 가능

// 등록된 폰트 이름 보기

NSArray* tempFonts = [UIFont familyNames];

for(NSString* aFont in tempFonts)

NSLog(aFont);



무료 폰트 --> 헤움OTF 무료폰트96종
참고 링크 --> http://bit.ly/bl3zFi

by 재환이아빠 | 2011/10/05 11:34 | iPhone/iPot 개발 | 트랙백 | 덧글(0)

Monster Zombie 2: Undead Hunter

9월 5일에 서비스된 몬스터 좀비2..
이 프로젝트에는 [파트애니메이션]을 적용해보았다.
다른 사람들은 뭐라고 명명하는지 모르겠지만, 머리, 몸, 팔, 다리 등 따로 다음 프레임과 보간 애니메이션을 줘서
부드러운 움직임을 표현할수 있도록 구현했다.
캐릭터의 부위가 따로 있어서 장비나 총을 바꿔 착용할수 있는 [커스튬방식]을 적용했다.
캐릭터의 움직임을 총이나 스탯에 따라 미세한 시간까지 다 적용했기 때문에 유저 입장에서는 키운 만큼 만족감을 
채울수 있을거라 기대된다.

지금은 [매직큐브]와 [아미워즈 디펜스2]을 개발 마무리 중이다. 멀티플레이가 지원되는데..
확실히 유저와 유저간의 전투가 재미있는것 같다.

몬스터 좀비2에는 다음 업데이트시에 멀티플레이를 적용할 예정이다. 유저간의 전투를 적용할지
유저와 힘을 모아 스테이지를 공략하도록 할지 아직 결정된 사항은 없다.
허나 곧 업데이트 할 것이다.

서비스후 리뷰가 나왔다.
출처 : http://appadvice.com

Elude The Hordes Of Zombies And Take Them Out One By One In Monster Zombie 2: Undead Hunter

Monster Zombie 2: Undead Hunter by AFEEL, Inc. icon

Monster Zombie 2: Undead Hunter ($0.99) by AFEEL, Inc. is a strategic action game that doesn’t disappoint. Cute and crisp graphics, gameplay that keeps you on your toes, and zombies — you just can’t go wrong.

IMG_7436

So, you’re a cute red-headed anime chick with weaponry. This cannot get any better for you. But wait — here come the zombies. Mobs and mobs of zombies. Some of them throw things at you, some of them are faster than others, but one thing is for certain: they all want to chow down on your gray matter.

You begin with a small dagger for melee attacks and a bow for ranged attacks. It’s like you’re playing Word of Warcraft and you chose a hunter. This excited me. Finally! A chance to show off my mad hunter kiting skills in an iOS game! I knew all of those hours I should have been studying, but instead I wasted in battlegrounds, would all be worth it one day.

To change weapons, tap the weapon slot on the top right of your screen. You use the left joystick to move around, and the right to attack. I’m going to be honest with you, though, I hung out with my bow 99 percent of the time. I slowly walked my cute little red-haired butt around the forest, gathered up all of the zombies, and started wreaking havoc with my arrows.

This is what you must do in this game: kite the zombies around and take them out, one by one, before they even begin to bare their teeth at you. Eluding your enemies and utilizing ranged attacks is what wins this game. We got this.

Not all of the zombies are the same. Some have special attacks, and you even come across a few other creatures and bosses as well. Trust me, this game may seem repetitive but it’s quite challenging and each level is different.

You can upgrade not only your weapons, but your armor and trinkets as well. You use the in game gold to purchase these items from the shop. However, if you choose, you can spend some real life dollars on the gold to get those upgrades more quickly.

IMG_7423

Monster Zombie 2: Undead Hunter has five stages, with 125 levels total, and full Game Center support. I found it engaging and just fun to play; but, then again, I really enjoyed the kiting and the zombie killing.

It is a universal app and is available in the App Store for only $0.99. I’d say it’s well worth the buck! What do you think?

by 재환이아빠 | 2011/09/09 11:19 | 게임 및 컨텐츠 | 트랙백 | 덧글(4)

framework제작

1. Framework 만들기

 

1.   New Project -> Library -> Cocoa Touch StaticLibrary 생성

 

<그림1>

 

2.    Targets에있는 기본 Bundle 제거

 

<그림2>

 

 

3.   Targets -> Add -> New Target.. -> Cocoa-> Loadable Bundle생성

 

<그림3>

 

 

<그림4>

 

 


 

 

4.    TargetInfo창에서 Build탭 선택 후 아래 내용들 수정

(설정시 debugrelease모두 만들기 위해서는  configuration부분을 All Configurations로 바꿔주고 아래 항목들을 수정)

 

<그림5>

1)  Wrapper Extension 항목 -> framework

2)  Mach-O Type 항목 -> RelocatableObject File

3)  Dead Code Stripping -> 체크해제

4)  Link With Standard Libraried -> 체크해제

5)  Other Linker Flags -> 내용 전부 제거

6)  GCC_PREFIX_HEADER -> 내용 전부 제거

7)  Insight의 경우 Header SearchPaths  ->  /usr/include/libxml2 추가

 

 

5.   Target Info창에서 Properties탭에서 화면 아래 “open Ingo.plist as File”  버튼 클릭후

Bundle OS Type code 내용을 FMWK로 수정후 저장

 

 

<그림6>

6.   Targets안에 있는 Insight(Bundle) 우클릭-> Add -> New Build Phase –--

---> New Copy Headers Builds Phase 생성

 

<그림7>

 

 

7.   Insight.framework에 추가시킬 구현 파일들을  Groups & Files -> Classes 안으로 드래그 (copy items into… 체크해서 파일을 복사. 체크를 안하면 참조로 됨)

(구현 파일들이 이미 생성되있지 않을때는 직접 AddNew로 만들어서 구현하는것도 가능)

 

<그림 8-1>

 

<그림 8-2>

8.   위와 같은 방법으로 Groups & Files Other Sources부분에 이미지나 사운드등 필요한 Resource들을 추가

(Framework을 만들때는 다른 Framework을 추가할 필요 없음)

 

 

9.   파일을 추가시키고나면 

Targets -> Insight -> Copy Bundle Resources(Resource)

Targets -> Insight -> Compile Sources (.m과 같은 구현파일들)

Targets -> Insight -> Copy Headers (.h와 같은 헤더파일들)

위의 부분에 자동으로 사용자가 추가한 항목들이 추가됨.

 

<그림9>

 

 

10. Targets -> Insight-> Copy Headers 우클릭 -> Set Role -> Public 클릭

(이 설정을 하지 않으면 framework에서 헤더파일이 보이지 않)

<그림10>

 

 

11. DebugRelease를 선택후 빌드하면

현재 프로젝트 폴더안에 Build-> Debug-iphonesimulator -> Insight.framework 폴더 또는 Build-> Release-iphonesimulator -> Insight.framework 폴더 자체가 프레임 워크.

 

 

 

 

 

 

 

 

2. 프로젝트에서의 사용방법.

 

 

1.   생성한 framework를 작업중인 project폴더에 추가.

Ex) Framework 이라는 폴더를 생성후 생성한 Insight.framework폴더를 붙여넣기.

 

 

 

2.   Insight.framework폴더를 프로젝트의 Frameworks폴더로 드래그

 

<그림11>

 

<그림 11-1>

 

위와 같이 Frameworks폴더에 넣으면 Targets->NPMK->LinkBinary With Libraries에 자동으로 추가되고  TargetsInfo에서 Framework경로를 직접 잡아줌.

(여러개의 framework(debug, release,simulator, device) 추가시 Target Info-> Framework Search Paths 의 값을  "$(SRCROOT)"  수정)

<그림12>

by 재환이아빠 | 2011/06/23 09:44 | iPhone/iPot 개발 | 트랙백 | 덧글(0)

◀ 이전 페이지          다음 페이지 ▶