OpenGL 프로젝트
< animate the fire >
팀명 Basis
20051441 김수영
20051559 양자경
20051664 차미나
CONTENTS
목적 및 개요
프로젝트 소개
소스분석
결과보고
실행화면 (1),(2)
프로젝트 후기
목적 및 개요
그래픽 프로그래밍에 대한 이해 .
OpenGL 에 관한 이해 .
전체적으로 깊이 있는 학습 유도 .
개인 능력 확인 및 향상 .
수업 내용의 응용 학습 유도 .
팀 프로젝트 적응 및 팀원간의 유대감형성
개발환경 )
WindowsXP, Microsoft Visual C++ 6.0
프로젝트 소개
animate the fire 은 OpenGL 을 사용하여 모닥
불을 피우는 모습을 표현한 작품이다 .
소스분석
// 타이머 정보 . 성능 다른 컴퓨터들 사이에서 프레임 동일 유지를 위해 ,,
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()
{
소스분석
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 초기화한다 .
소스분석
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); // 반투명 텍스쳐 위해 블렌딩 모드 지정
소스분석
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
}
소스분석
#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