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

  • Upload
    joben

  • View
    45

  • Download
    0

Embed Size (px)

DESCRIPTION

Introduction to OpenGL Pipeline From Programmer View. Tong-Yee Lee. OpenGL Transformation Pipeline. normalized device. eye. object. clip. window. v e r t e x. Modelview Matrix. Projection Matrix. Perspective Division. Viewport Transform. Modelview. Projection. Modelview. - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction to OpenGL Pipeline  From  Programmer View

Introduction to OpenGL Introduction to OpenGL Pipeline From Pipeline From

Programmer ViewProgrammer ViewTong-Yee Lee

Page 2: Introduction to OpenGL Pipeline  From  Programmer View

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

3D Transformations3D Transformations

Page 4: Introduction to OpenGL Pipeline  From  Programmer View

OpenGL transformation OpenGL transformation MatricesMatrices

Page 5: Introduction to OpenGL Pipeline  From  Programmer View

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

Changes of Coordinate Changes of Coordinate SystemSystem

World coordinate system

Camera (eye) coordinate system

Page 7: Introduction to OpenGL Pipeline  From  Programmer View

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
Page 9: Introduction to OpenGL Pipeline  From  Programmer View

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

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

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

64

Depth Buffering andHidden Surface Removal

12

48

16

12

48

16ColorBuffer

DepthBuffer

Display