OpenGL Transformation - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

OpenGL Transformation

Description:

Stack operation of matrix is very useful for constructing a hierarchical structures. ... gluLookAt( cx, cy, cz, cx ox, cy oy, cz oz, upx, upy, upz ) ... – PowerPoint PPT presentation

Number of Views:89
Avg rating:3.0/5.0
Slides: 13
Provided by: jll7
Category:

less

Transcript and Presenter's Notes

Title: OpenGL Transformation


1
OpenGL Transformation
  • Jian-Liang Lin
  • 2002

2
Transformation -1
3
Transformation -2
  • There are three matrix stacks in OpenGL
    architecture
  • MODELVIEW, PROJECTION, TEXTURE
  • glMatrixMode( GLenum mode )
  • mode GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE
  • Current matrix mode is also a OpenGL state
    variable.

4
Transformation -3
  • Matrix Manipulation
  • glLoadIdentity()
  • glLoadMatrixf,d( const TYPE m )
  • glMultMatrixf,d( const TYPE m )
  • glPushMatrix()
  • glPopMatrix()
  • Stack operation of matrix is very useful for
    constructing a hierarchical structures.
  • Ex Render a car with four wheels.

5
Transformation -4
  • OpenGL built-in transformation
  • glTranslatef,d( TYPE x, TYPE, y, TYPE z )
  • Multiply a translation matrix into current matrix
    stack
  • glRotatef,d( TYPE angle, TYPE x, TYPE y, TYPE z
    )
  • Multiply a rotation matrix about an arbitrary
    axis into current matrix stack
  • glScalef,d( TYPE x, TYPE y, TYPE z )
  • Multiply a scaling matrix into current matrix
    stack

6
Transformation -5
  • Viewing transformation
  • Choose your viewing system
  • Center-orientation-up system
  • Apply gluLookAt Utility routine.
  • gluLookAt( cx, cy, cz, cxox, cyoy, czoz, upx,
    upy, upz )
  • ( cx, cy, cz ) is the center of the camera
  • ( ox, oy, oz ) is the orientation vector of the
    camera
  • ( upx, upy, upz ) is the up vector of the camera
  • Polar coordinate system
  • Combine translation and two rotation.

7
Transformation -6
  • Projection transformation Perspective projection
  • glFrustum( GLdouble left, GLdouble right,
    GLdouble bottom, GLdouble top, GLdouble near,
    GLdouble far )

8
Transformation -7
  • gluPerspective( GLdouble fovy, GLdouble aspect,
    GLdouble near, GLdouble far )

9
Transformation -8
  • Projection transformation Orthogonal projection
  • glOrtho( GLdouble left, GLdouble right, GLdouble
    bottom, GLdouble top, GLdouble near, GLdouble far
    )
  • gluOrtho2D( GLdouble left, GLdouble right,
    GLdouble bottom, GLdouble top )
  • A helper to create a 2D projection matrix

10
Transformation -9
  • Viewport transformation
  • glViewport( GLint x, GLint y, GLsizei w, GLsizei
    h )
  • Initial viewport is as the same size as the window

11
Transformation -10
  • Note
  • By default, the viewpoint as well as objects in
    the scene are originally situated at the origin,
    and is looking down the negative z-axis, and has
    the positive y-axis as straight up.

12
Any Question?
  • ?
Write a Comment
User Comments (0)
About PowerShow.com