Lecture 7

1 / 34

# Lecture 7 - PowerPoint PPT Presentation

Lecture 7. Geometrical Transformations: 2D transformations 3D transformations Matrix representation OpenGL functions. Rendering Pipeline. Rendering Pipeline. Rendering Pipeline. Rendering Pipeline. Basic 2D Transformations. Basic 2D Transformations. Basic 2D Transformations.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Lecture 7' - nyla

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Lecture 7

Geometrical Transformations:

2D transformations

3D transformations

Matrix representation

OpenGL functions

2x2 matrices
• Only rotation, scaling, and shear can be represented in 2x2 matrix form.
• These are linear transformations.
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.

OpenGL Matrix Stacks

Clears the currently modifiable matrix for future transformation instructions.

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

OpenGL Matrix Stacks

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

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.

OpenGL Matrix Stacks

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

glMultMatrix(const type *m);

m1 m5 m9 m13

m2 m6 m10 m14

m3 m7 m11 m15

m4 m8 m12 m16

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.

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.

Summary
• Types of transformations:
• linear
• affine
• projective
• Representation of transformations:
• 3x3 and 4x4 matrices
• homogeneous coordinates
• Compositions of transformations
• OpenGL Matrix Instructions