12
Introduction to OpenGL Introduction to OpenGL Pipeline From Pipeline From Programmer View Programmer View Tong-Yee Lee

Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

  • View
    233

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

Introduction to OpenGL Introduction to OpenGL Pipeline From Pipeline From

Programmer ViewProgrammer ViewTong-Yee Lee

Page 2: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

vertex

ModelviewMatrix

ProjectionMatrix

PerspectiveDivision

ViewportTransform

Modelview

Modelview

Projection

object eye

clip normalizeddevice

window

OpenGL Transformation OpenGL Transformation PipelinePipeline

glTranslate{fd}( glTranslate{fd}( x, y, zx, y, z ) )

glRotate{fd}( glRotate{fd}( angle, x, y, zangle, x, y, z ) )

glScale{fd}( glScale{fd}( x, y, zx, y, z ) )

Page 3: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

3D Transformations3D Transformations

Page 4: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

OpenGL transformation OpenGL transformation MatricesMatrices

Page 5: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

vertex

ModelviewMatrix

ProjectionMatrix

PerspectiveDivision

ViewportTransform

Modelview

Modelview

Projection

object eye

clip normalizeddevice

window

OpenGL Transformation OpenGL Transformation PipelinePipeline

gluLookAt( eyegluLookAt( eyexx, eye, eyeyy, eye, eyezz,, aim aimxx, aim, aimyy, aim, aimzz,, up upxx, up, upyy, up, upzz ) )

tripod

Page 6: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

Changes of Coordinate Changes of Coordinate SystemSystem

World coordinate system

Camera (eye) coordinate system

Page 7: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

vertex

ModelviewMatrix

ProjectionMatrix

PerspectiveDivision

ViewportTransform

Modelview

Modelview

Projection

object eye

clip normalizeddevice

window

OpenGL Transformation OpenGL Transformation PipelinePipeline

model

viewingvolume

Perspective Perspective projectionprojectionOrthographic Orthographic parallel projectionparallel projection

Page 8: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee
Page 9: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

Perspective projectionPerspective projectiongluPerspective( gluPerspective( fovy, aspect, zNear, zFarfovy, aspect, zNear, zFar ) )

glFrustumglFrustum(( left,left, right,right, bottom,bottom, top,top, zNear,zNear, zFarzFar ))

Orthographic parallel projectionOrthographic parallel projectionglOrtho(glOrtho( left,left, right,right, bottom,bottom, top,top, zNear,zNear, zFarzFar ))

gluOrtho2D( gluOrtho2D( left, right, bottom, topleft, right, bottom, top ) )

Page 10: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

vertex

ModelviewMatrix

ProjectionMatrix

PerspectiveDivision

ViewportTransform

Modelview

Modelview

Projection

object eye

clip normalizeddevice

window

glViewport( 0, 0, (GLsizei) w, (GLsizei) h );glViewport( 0, 0, (GLsizei) w, (GLsizei) h );ww

hh

Page 11: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

glMaterialfv( glMaterialfv( face, property, valueface, property, value ); );

glLightfv( glLightfv( light, property, valuelight, property, value ); );

glNormal3f( glNormal3f( x, y, zx, y, z ) )

Page 12: Introduction to OpenGL Pipeline From Programmer View Tong-Yee Lee

64

Depth Buffering andHidden Surface Removal

12

48

16

12

48

16ColorBuffer

DepthBuffer

Display