Open GL l texture mapping l Z l

  • Slides: 41
Download presentation

Open. GL 기능 l 텍스처 매핑(texture mapping) l 깊이 버퍼 사용(Z 버퍼링) l 이중

Open. GL 기능 l 텍스처 매핑(texture mapping) l 깊이 버퍼 사용(Z 버퍼링) l 이중 버퍼링(double buffering) l 명암 효과(lighting effects) l 한면의 명암이 다른 효과(smooth shading) l 길감속성(material properties)

Open. GL 관련 라이브러리 l Open. GL(GL) l l Open. GL Utility Library(GLU) l

Open. GL 관련 라이브러리 l Open. GL(GL) l l Open. GL Utility Library(GLU) l l Open. GL을 제어하는 기본적인 함수들 GL 보다 상위 기능 지원 (U = Utility) Open. GL Extension to the X Window(GLX)

Open. GL 관련 라이브러리 l Open. GL Utility Toolkit(GLUT) l l 윈도우 시스템과의 인터페이스

Open. GL 관련 라이브러리 l Open. GL Utility Toolkit(GLUT) l l 윈도우 시스템과의 인터페이스 (T = Toolkit) Open Inventor Object-oriented toolkit based on Open. GL l Interactive three-dimensional graphic library l

Open. GL 데이터 타입 suffix 데이터 타입 b s i f d ub us

Open. GL 데이터 타입 suffix 데이터 타입 b s i f d ub us ui C언어 유형 8 bit 정수 signed char 16 bit 정수 short 32 bit 정수 long 32 bit 실수 float 64 bit 실수 double 8 bit 부호없는 정수 unsigned char 8 bit 부호없는 정수 unsigned 8 bit 부호없는 정수 short unsigned long Open. GL 유형 GLbyte GLshort GLint, GLsizei GLfloat, GLclampf GLdouble, GLclampd GLubyte, GLboolean GLushort GLuint, GLenum, GLbitfield

설정 (Visual Studio) l Visual c++에서는 Open. GL의 기본적인 library들이 default로 설치됨 l Dynamic

설정 (Visual Studio) l Visual c++에서는 Open. GL의 기본적인 library들이 default로 설치됨 l Dynamic Link Library 설치 l opengl 32. dll, glut 32. dll l Window 98, Window Me c: WindowsSystem l Window 2000 C: WINNTSystem 32 l Window XP C: WindowsSystem 32

설정 (Visual Studio) l (cont) Open. GL Library 설치 l opengl 32. lib, glu

설정 (Visual Studio) l (cont) Open. GL Library 설치 l opengl 32. lib, glu 32. LIB, glut 32. lib l C: Program fileMicrosoft Visual StudioVC 98Lib l Open GL Header 설치 l gl. h, glut. h, glaux. h l C: Program fileMicrosoft Visual Studio VC 98includeGL

설정 (Visual Studio) (cont)

설정 (Visual Studio) (cont)

설정 (Visual Studio) l (cont) Open. GL 공식 사이트 http: //www. opengl. org l

설정 (Visual Studio) l (cont) Open. GL 공식 사이트 http: //www. opengl. org l Glut 다운로드 페이지 l l http: //www. opengl. org/resources/libraries/glut/ glut_downloads. html

Simple Sample

Simple Sample

Simple Sample (cont)

Simple Sample (cont)

Simple Sample l 실행 결과 (cont)

Simple Sample l 실행 결과 (cont)

Simple Sample l (cont) glut. Init. Display. Mode (GLUT_SINGLE | GLUT_RGB) 사용할 출력모드를 GLUT

Simple Sample l (cont) glut. Init. Display. Mode (GLUT_SINGLE | GLUT_RGB) 사용할 출력모드를 GLUT 라이브러리에 알림 l GLUT_SING : 싱글 버퍼창 사용 l GLUT_RGB : RGB 생상모드 사용 l

Simple Sample l (cont) gl. Clear. Color(0. 0 f, 1. 0 f); 창을 지우기

Simple Sample l (cont) gl. Clear. Color(0. 0 f, 1. 0 f); 창을 지우기 위한 색상 지정 l 프로토타입 : void gl. Clear. Color(GLclampf 적색, Glclampf 녹색, Glclampf 청색, Glclampf 알파값); l 값의 범위 : 0. 0 ~ 1. 0 l

도형 그리기 l (cont) gl. Rectf(-25. 0 f, -25. 0 f); gl. Color 3

도형 그리기 l (cont) gl. Rectf(-25. 0 f, -25. 0 f); gl. Color 3 f 명령을 통해 색상 설정 후 사용 l 프로토타입 : void gl. Rectf(Glfloat x 1, Glfloat y 1, Glfloat x 2, Glfloat y 2) l

도형 그리기 l (cont) 클리핑 영역 설정 Void gl. Ortho(GLdouble left, GLdouble right, GLdouble

도형 그리기 l (cont) 클리핑 영역 설정 Void gl. Ortho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far); l 직교 좌표계 사용 (gl. Ortho()) l l left, right : x축의 최소, 최대값 l bottom, top : y축의 최소, 최대값 l near, far : z축의 최소, 최대값

Polygon Example

Polygon Example

Spring Example

Spring Example

Spring Example (cont)

Spring Example (cont)

Spring Example (cont)

Spring Example (cont)

Spring Example (cont)

Spring Example (cont)

Line Example l Spring 예제의 Render. Scene() 부분 수정

Line Example l Spring 예제의 Render. Scene() 부분 수정