Introduction of OpenGL - Transformation - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Introduction of OpenGL - Transformation

Description:

Title: 1 Author: chen Last modified by: Yulu Chen Created Date: 12/5/2002 7:28:06 AM Document presentation format: Other titles – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 12
Provided by: chen217
Category:

less

Transcript and Presenter's Notes

Title: Introduction of OpenGL - Transformation


1
Introduction of OpenGL- Transformation
  • Luke Yulu Chen

2
Review
  • OpenGL Command Syntax

g l C o l o r 3 f ()
gl library
command
number of arguments
data type of arguments
3
Review (2)
  • Specifying Color
  • glColor3f (float r, float g, float b)
  • r, g, b are floating points from 0 to 1
  • glColor3ub (int r, int g, int b)
  • r, g, b are integers from 0 to 255

4
Review (3)
  • Specifying Vertices
  • glVertex2f (float x, float y)
  • 2D coordinates
  • glVertex3f (float x, float y, float z)
  • 3D coordinates
  • Calls to glVertex( ) are only effective between
    a glBegin( ) and glEnd( ) pair.

5
Review (3)
  • OpenGL Geometric Drawing Primitives
  • glBegin (primitives type)
  • glVertex( )
  • glEnd ( )
  • Primitives Type
  • GL_POINTS, GL_LINES, GL_POLYGON

6
OpenGL Transformation
  • Viewing Transformations
  • change the position and orientation of the
    viewpoint
  • Modeling Transformations
  • transform objects by shifting, rotating and
    scaling them

7
Modeling Transformation
  • Translation
  • Rotation
  • Scaling

8
Order of Transformation
9
Transformation Commands (1)
  • Translate
  • glTranslatef (float x, float y, float z)
  • ex. glTranslatef (50.0, 50.0, 0.0)

10
Transformation Commands (2)
  • Rotate
  • glRotatef (float angle, float x, float y, float
    z)
  • rotates an object in a counterclockwise direction
    about the vector from the origin through the
    point (x, y, z)
  • ex. glRotatef (30.0, 0.0, 0.0, 1.0)

11
Transformation Commands (3)
  • Scale
  • glScalef (float x, float y, float z)
  • ex. glScalef (2.0, -0.5, 0.0)
Write a Comment
User Comments (0)
About PowerShow.com