Lecture10-GamesOpenGL

# 1 glloadidentity 2 glt 00 3 00 10 4 glutcube 10

• Notes
• 16

This preview shows page 13 - 16 out of 16 pages.

1. glLoadIdentity(); 2. glTranslatef (5.0, 0.0, 0.0); 3. glRotatef (45, 0.0, 0.0, 1.0); 4. glutCube (1.0);

Subscribe to view the full document.

Transformations in OpenGL Each transformation modifies the matrix on the top of the matrix stack. 1. glLoadIdentity(); 2. glTranslatef (5.0, 0.0, 0.0); 3. glRotatef (45, 0.0, 0.0, 1.0); 4. glutCube (1.0); Reading it in this direction, the interpretation is: Draw a cube, rotate it then translate it, then do nothing to it.
Transformations in OpenGL Each transformation modifies the matrix on the top of the matrix stack. 1. glLoadIdentity(); 2. glTranslatef (5.0, 0.0, 0.0); 3. glRotatef (45, 0.0, 0.0, 1.0); 4. glutCube (1.0); Reading it in this direction, the interpretation is: Push identity matrix on the stack, multiply it by a translation matrix, Multiply that by a rotation matrix. Draw a cube and transform it using the matrix on top of the stack. Or, Translate the coordinate system 5 along x, Then rotate the coordinate system and draw a cube.

Subscribe to view the full document.

Matrix Transformation Stack 1. glClear (GL_COLOR_BUFFER_BIT); 2. glPushMatrix(); 3. glTranslatef (-1.0, 0.0, 0.0); 4. glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0); 5. glTranslatef (1.0, 0.0, 0.0); 6. glPushMatrix(); 7. glScalef (2.0, 0.4, 1.0); 8. glutWireCube (1.0); 9. glPopMatrix(); … let’s see that for real
You've reached the end of this preview.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern