Transformations - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Transformations

Description:

Clip Coordinates. ModelView. Matrix. Projection. Matrix. Perspective. Division ... Object Local Coordinates. Stages of Vertex Transformations. COMP341 Fall 2002 ... – PowerPoint PPT presentation

Number of Views:251
Avg rating:3.0/5.0
Slides: 15
Provided by: george308
Category:

less

Transcript and Presenter's Notes

Title: Transformations


1
Transformations
  • Modeling Transformation
  • Viewing Transformation
  • Projection Transformation
  • Viewport Transformation

2
How to Draw 3-D object on Screen?
3
Drawing a Scene
  • Apply modeling and viewing transformations
  • Apply projection transformation
  • Clip if it lies outside the viewing volume
  • Apply viewport transformation to display on the
    screen

4
Stages of Vertex Transformations
  • Object Local Coordinates
  • ModelView
  • Matrix
  • Projection
  • Matrix
  • Eye Coordinates
  • Vertex
  • Clip Coordinates
  • Normalized Device Coordinates
  • Viewport
  • Transformation
  • Perspective
  • Division
  • Windows Coordinates

5
Matrix Stacks
  • OpenGL maintains 3 matrix stacks
  • Projection, Modelview, Texture
  • Use glMatrixMode() to specify which matrix stack
    is active
  • glMatrixMode(GLenum mode)
  • Modes GL_PROJECTION, GL_MODELVIEW, GL_TEXTURE

6
Matrix Stacks (Cont)
  • The topmost matrix on a stack is called its
    current matrix
  • When vertices of geometric primitive are drawn,
    OpenGL multiplies the current matrices of the
    stacks by the vertices

7
Matrix Stacks (Cont)
  • There are several routines for manipulating
    matrix stacks
  • glPushMatrix()
  • glPopMatrix()
  • glLoadMatrix()
  • glMultMatrix()
  • glLoadIdentity()

8
Modeling Transformation
  • Positions and orients the objects
  • Rotation glRotatefd(angle, x, y, z)
  • Translation glTranslatefd(x, y, z)
  • Scaling glScalefd(x, y, z)

9
Modeling Transformation (Cont)
10
Modelview Matrix
  • Pulling the camera back from the object (viewing
    transformation) ? moving the object away from the
    camera (modeling transformation)
  • Thus, both viewing and modeling transformations
    are stored in the modelview matrix stack

11
Post-multiplication
glTranslate()
glPushMatrix()
glRotate()
12
Order of Transformations
  • Specify the transformations in the reverse order
    of the way you conceptualize them

Specify
M1M2v
Conceptualize
13
Order of Transformations (Cont)
  • Example 1 TRv

glTranslatef(2.0,0.0,0.0) glRotatef(45.0,0.0,0.0,1
.0)
14
Order of Transformations (Cont)
  • Example 2 RTv

glRotatef(45.0,0.0,0.0,1.0) glTranslatef(2.0,0.0,0
.0)
Write a Comment
User Comments (0)
About PowerShow.com