OpenGL Introduction
description
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 - PowerPoint PPT Presentation
Transcript of OpenGL Introduction
Chapter ObjectivesOnly 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
OpenGL
OpenGL 1.0
IRIS GL 1992 7 OpenGL 1.0
+
3D
GL
OpenGL Utility (Glu)
OpenGL Auxiliary (Glaux)
() , , Object
GLUquadricObj
GLUquadricObj *pObj;
pObj = gluNewQuadric();
Aux(Glaux)
GL wgl :
GL
, , 3 , ,
OpenGL
initialize GL states (e. g., viewing, color, lighting)
initialize display lists
if window event (window moved, exposed, etc.)
— modify viewport, if needed
— do something, e. g., change states & redraw
Structure of a Typical Program
OpenGL
render some graphics
change more states
#include <GL/glaux.h>
{
glClear(GL_COLOR_BUFFER_BIT); // set clear color
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);
state(mode)
color , object color .
Current color .
other state variables
OpenGL
capability can be one of :
GL_ BLEND (alpha blending)
GL_ FOG
GL_ LIGHTING
OpenGL
GLUT
handle keyboard, mouse, and redraw events
Open Inventor
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
OpenGL
OpenGL 1.0
IRIS GL 1992 7 OpenGL 1.0
+
3D
GL
OpenGL Utility (Glu)
OpenGL Auxiliary (Glaux)
() , , Object
GLUquadricObj
GLUquadricObj *pObj;
pObj = gluNewQuadric();
Aux(Glaux)
GL wgl :
GL
, , 3 , ,
OpenGL
initialize GL states (e. g., viewing, color, lighting)
initialize display lists
if window event (window moved, exposed, etc.)
— modify viewport, if needed
— do something, e. g., change states & redraw
Structure of a Typical Program
OpenGL
render some graphics
change more states
#include <GL/glaux.h>
{
glClear(GL_COLOR_BUFFER_BIT); // set clear color
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);
state(mode)
color , object color .
Current color .
other state variables
OpenGL
capability can be one of :
GL_ BLEND (alpha blending)
GL_ FOG
GL_ LIGHTING
OpenGL
GLUT
handle keyboard, mouse, and redraw events
Open Inventor