13
OpenGL 프프프프 < animate the fire > 팀팀 Basis 20051441 김김김 20051559 김김김 20051664 김김김

OpenGL 프로젝트 < animate the fire >

  • Upload
    doctor

  • View
    265

  • Download
    4

Embed Size (px)

DESCRIPTION

OpenGL 프로젝트 < animate the fire >. 팀명 Basis 20051441 김수영 20051559 양자경 20051664 차미나. CONTENTS. 목적 및 개요 프로젝트 소개 소스분석 결과보고 실행화면 (1),(2) 프로젝트 후기. 그래픽 프로그래밍에 대한 이해 . OpenGL 에 관한 이해 . 전체적으로 깊이 있는 학습 유도 . 개인 능력 확인 및 향상 . 수업 내용의 응용 학습 유도 . 팀 프로젝트 적응 및 팀원간의 유대감형성 - PowerPoint PPT Presentation

Citation preview

Page 1: OpenGL  프로젝트 <  animate the fire  >

OpenGL 프로젝트< animate the fire >

팀명 Basis

20051441 김수영 20051559 양자경20051664 차미나

Page 2: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

CONTENTS

목적 및 개요 프로젝트 소개 소스분석 결과보고 실행화면 (1),(2) 프로젝트 후기

Page 3: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

목적 및 개요

그래픽 프로그래밍에 대한 이해 . OpenGL 에 관한 이해 . 전체적으로 깊이 있는 학습 유도 . 개인 능력 확인 및 향상 . 수업 내용의 응용 학습 유도 . 팀 프로젝트 적응 및 팀원간의 유대감형성

개발환경 )WindowsXP, Microsoft Visual C++ 6.0

Page 4: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

프로젝트 소개

animate the fire 은 OpenGL 을 사용하여 모닥불을 피우는 모습을 표현한 작품이다 .

Page 5: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

소스분석

// 타이머 정보 . 성능 다른 컴퓨터들 사이에서 프레임 동일 유지를 위해 ,, extern float fTime, fDeltaTime;

// Current window dimensions. extern GLsizei g_w, g_h; #ifndef NOEXTENSION extern HWND g_hwnd; #endif #include "FirePart.h"

#ifndef NOEXTENSION

// 메시지창 호출 함수 bool Splash() {

Page 6: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

소스분석

return MessageBox(NULL, " \" \" : rotate/stop camera\n" " ENTER : stop fire animation\n" " ESC : put water on the fire\n" "\n" "Enjoy it :-) Hufo / N.A.A.\n" ,szAppName ,MB_OKCANCEL | MB_ICONWARNING) == IDOK; return True; } #endif

bool Init() // 윈도우 초기화 함수 뒤에 OpenGL 초기화 위해 불려짐 { glMatrixMode(GL_PROJECTION); // projection 모드로 설정하여 glLoadIdentity(); // GL Matrix 초기화한다 .

Page 7: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

소스분석

float x = (float)g_w/(float)g_h; // Correct the viewing ratio of the window in the X axis.

if (x>XSTD) gluOrtho2D( -x, x, -1, 1 ); // Reset to a 2D screen space. else gluOrtho2D( -XSTD, XSTD, -XSTD/x, XSTD/x ); // Reset to a

2D screen space. x0=x; // Reset model view matrix stack. glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); // modelview 모드 설정후 Matrix 초기화

glCullFace(GL_FRONT); // 앞면만 그려지도록 컬링 모드 설정 glDepthFunc(GL_LESS);

glBlendFunc(GL_SRC_ALPHA,GL_ONE); // 반투명 텍스쳐 위해 블렌딩 모드 지정

Page 8: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

소스분석

for (int i=0;i<9;++i) { CylColor[i].r=CylBColor.r*CylShad[i]; CylColor[i].g=CylBColor.g*CylShad[i]; CylColor[i].b=CylBColor.b*CylShad[i]; }

TFire=0.0; TVit=1.0; FireInit(); // initialise fire return true; // 모든 것이 잘 동작한다면 , return 은 true }

Page 9: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

소스분석

#ifndef NOEXTENSION static float secTime=fTime; static int nf=0; if (fTime-secTime>=1.0) { // aff framerate char buf[256]; sprintf(buf,"%s - %g fps",szAppName,nf/(fTime-secTime)); SetWindowText(g_hwnd,buf); secTime=fTime; nf=0; } #endif

TFire+=fDeltaTime*TVit; CalcFire(TFire,fDeltaTime*TVit); // 불을 움직이게 함 .

glClear( GL_COLOR_BUFFER_BIT

Page 10: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

결과보고

GL Matrix 초기화 >>> modelview 모드 설정후 Matrix 초기화하여

앞면만 그려지도록 컬링 모드 설정 , 반투명 텍스쳐 위해 블렌딩 모드 지정

불을 움직이게 한다 .CalcFire(TFire,fDeltaTime*TVit);

Page 11: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

실행화면

그림 (1) 실행 초기 화면

Page 12: OpenGL  프로젝트 <  animate the fire  >

Computer Graphics(20071)

실행화면

그림 (2) 모닥불꺼지는 모습

Page 13: OpenGL  프로젝트 <  animate the fire  >

프로젝트 후기

그저 결과물만 보기에는 정말 간단한 프로그램이다 . 하지만 게임이나 영화에서나 보던 컴퓨터 그래픽으로 처음으로 직접 제작해 보고 그 원리와 구조를 알게 된 것은 값진 수확이라고 생각한다 .

Computer Graphics(20071)