1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation...

34
1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    228
  • download

    3

Transcript of 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation...

Page 1: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

1

Lecture 7

Geometrical Transformations:

2D transformations

3D transformations

Matrix representation

OpenGL functions

Page 2: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

2

Rendering Pipeline

Page 3: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

3

Rendering Pipeline

Page 4: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

4

Rendering Pipeline

Page 5: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

5

Rendering Pipeline

Page 6: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

6

Basic 2D Transformations

Page 7: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

7

Basic 2D Transformations

Page 8: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

8

Basic 2D Transformations

Page 9: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

9

Matrix representation

Page 10: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

10

Combination of 2D transformations

Page 11: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

11

2x2 matrices

Page 12: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

12

2x2 matrices

Page 13: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

13

2x2 matrices

Page 14: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

14

2x2 matrices

Page 15: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

15

2x2 matrices

Only rotation, scaling, and shear can be represented in 2x2 matrix form.

These are linear transformations.

Page 16: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

16

Linear transformations

Page 17: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

17

2D Translation: 3x3 matrix

Page 18: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

18

Homogeneous coordinates

Page 19: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

19

Basic 2D transformations in homogeneous coordinates

Page 20: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

20

Affine transformations

Page 21: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

21

Projections

Page 22: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

22

Matrix compositions

Page 23: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

23

Matrix compositions

Page 24: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

24

Matrix compositions

Page 25: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

25

3D transformations

Page 26: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

26

Basic 3D transformations

Page 27: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

27

Basic 3D transformations

Page 28: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

28

OpenGL Matrix Stacks

OpenGL works with stacks of 4x4 matrices:

glMatrixMode(enum mode);

mode:

GL_MODELVIEWGL_PROJECTIONGL_TEXTURE

Specifies whether the modelview, projection or texture matrix will be modified.

Page 29: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

29

OpenGL Matrix Stacks

glLoadIdentity(void);

Clears the currently modifiable matrix for future transformation instructions.

Typically we call this instruction before specifying modeling, viewing or projection transformations.

Page 30: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

30

OpenGL Matrix Stacks

Manipulating stacks: the OpenGL calls to push, pop, or multiply top of stack

glLoadMatrix(void);

glMultMatrix(void);

glPushMatrix(void); the topmost matrix is copied

glPopMatrix(void); the topmost matrix is destroyed

All vertices of the object are multiplied by the matrix.

Page 31: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

31

OpenGL Matrix Stacks

Manipulating stacks: the OpenGL calls to push, pop, or multiply top of stack

glLoadMatrix(const type *m);

glMultMatrix(const type *m);

m1 m5 m9 m13

m2 m6 m10 m14

m3 m7 m11 m15

m4 m8 m12 m16

Page 32: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

32

OpenGL Matrix Stacks

Manipulating stacks: the OpenGL calls to push, pop, or multiply top of stack

glPushMatrix(void); the topmost matrix is copied

glPopMatrix(void); the topmost matrix is destroyed

All vertices of the object are multiplied by the matrix.

Page 33: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

33

OpenGL Transformations

glTranslate(TYPE x, TYPE y, TYPE z);

Multiplies the current matrix by a translation matrix.

glRotate(TYPE angle, TYPE x, TYPE y, TYPE z);

Multiplies the current matrix by a rotation matrix.

glScale(TYPE x, TYPE y, TYPE z);

Multiplies the current matrix by a scaling matrix.

Page 34: 1 Lecture 7 Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions.

34

Summary

Types of transformations:– linear– affine– projective

Representation of transformations:– 3x3 and 4x4 matrices– homogeneous coordinates

Compositions of transformations OpenGL Matrix Instructions