1 / 15

OpenGL Introduction

OpenGL Introduction. 컴퓨터 그래픽스 김 창 헌. Contents. What is OpenGL ? OpenGL 의 역사 OpenGL 의 특징 OpenGL 의 구성 OpenGL Command Syntax Simple Example OpenGL-related Libraries. What is OpenGL?. A low- level graphics rendering and imaging library Only includes operations which can be accelerated

ramla
Télécharger la présentation

OpenGL Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OpenGL Introduction 컴퓨터 그래픽스 김 창 헌

  2. Contents • What is OpenGL ? • OpenGL의 역사 • OpenGL의 특징 • OpenGL의 구성 • OpenGL Command Syntax • Simple Example • OpenGL-related Libraries

  3. What is OpenGL? • A low- level graphics rendering and imaging library • Only includes operations which can be accelerated • A layer of abstraction between graphics hardware and an application program • Window system and OS Independent • use with Unix, Microsoft Windows, IBM OS/ 2, Apple Mac Os

  4. OpenGL의 역사 • IRIS GL에서 시작 • SGI의 워크스테이션 IRIS에서 구현된 그래픽 라이브러리인 IRIS GL에서 시작 • 이식성을 위해 기계에 종속적인 부분을 제거 • OpenGL 1.0 • 속도를 위해 IRIS GL의 기능을 일부 축소하여 1992년 7월 OpenGL 1.0을 발표 • 개방형 + 그래픽라이브러리

  5. OpenGL 1.1 • OpenGL ARB(Architecture Review Board) • SGI, DEC, IBM, 인텔, 마이크로소프트 • 3D그래픽 라이브러리의 표준으로 • OpenGL 1.1 (1995년 12월) • 텍스처 매핑을 개선 • RGBA모드에서 논리연산 가능 • 윈도우용 오픈GL

  6. OpenGL의 구성 • OpenGL(Gl) • 오픈GL의 핵심 • 오픈 GL을 제어하는 기본적인 함수들의 집합체 • 오픈GL의 렌더링과 관련된 기능들을 제공 • OpenGL Utility (Glu) • OpenGL Auxiliary (Glaux)

  7. Utility(Glu) • GL사용 시 발생하는 많은 반복작업 간소화 • (예) 구, 실린더, 디스크 등의 Object 생성 • GLUquadricObj • 꼭지점을 일일이 계산하여 각 점을 glVertex함수로 하나하나 찍어야 함. GLUquadricObj *pObj; pObj = gluNewQuadric(); gluSphere(pObj , 30.0 , 10 , 10); gluDeleteQuadric(pObj); // 객체를 삭제

  8. AUX Library • Aux(Glaux) • 오픈GL과 wgl함수를 이용해 선을 하나 렌더링하는 프로그램 : 많은 양의 코드 필요 • 플랫폼에 독립적인 윈도우 제어기능 • Glu를 능가하는 물체 생성기능을 가지는 툴킷 라이브러리 • 오픈GL프로그램을 처음 작성하는 사람 • 윈도생성, 입력제어, 3차원 물체 생성, 더블버퍼링, 텍스처 매핑용 이미지의 로딩

  9. OpenGL Command Syntax glColor3f Type of Arguments Gl library Root Command Number of Arguments

  10. Structure of a Typical Program • main: find GL visual & create window initialize GL states (e. g., viewing, color, lighting) initialize display lists check for events (and process them) if window event (window moved, exposed, etc.) — modify viewport, if needed — redraw else if mouse or keyboard — do something, e. g., change states & redraw

  11. 계속 • redraw: clear screen (to background color) change state( s), if needed render some graphics change more states render some more graphics .... swap buffers

  12. A Very Simple OpenGL Program #include <GL/glaux.h> int main(int argc, char ** argv) { auxInitDisplayMode( AUX_SINGLE | AUX_RGBA ); auxInitPosition(0, 0, 500, 500 ); auxInitWindow ( "My first OpenGL Program" ); glClearColor ( 0.0, 0.0, 0.0, 0.0 ); glClear(GL_COLOR_BUFFER_BIT); // set clear color glColor3f(1.0, 1.0, 1.0); // clear command glMatrixMode(GL_PROJECTION); glLoadIdentity(); // proceed with drawing before waiting for any more command glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(-0.5, 0.5); glVertex2f(0.5, 0.5); glVertex2f(0.5, -0.5); glEnd(); glFlush(); }

  13. OpenGL as a State Machine • 다양한 state(mode) 삽입 • 사용자가 바꾸기 전까지 유지 • (예) current color (state variable) • color를 바꾸면, 그 이후의 모든 object는 바뀐 color로 색칠됨. • Current color를 다른 색으로 바꿀 때까지 계속 유지됨. • other state variables • current viewing and projection transformation, polygon drawing modes, positions and characteristics of light 등

  14. State • glEnable (GLenum capability) • glDisable (GLenum capability) • GLboolean glIsEnabled (GLenum cap) • turn on and off OpenGL states • capability can be one of : • GL_ BLEND (alpha blending) • GL_ DEPTH_ TEST (depth buffer) • GL_ FOG • GL_ LIGHTING • GL_ LINE_ SMOOTH (line antialiasing)

  15. OpenGL-related Libraries • GLX • OpenGL Extension to the X Window System • GLUT • windowing utility library for OpenGL • handle keyboard, mouse, and redraw events • Open Inventor • object-oriented developers toolkit

More Related