We'll continue our discussion of various interesting aspects of OpenGL by considering animation, and showing you how to move the teapot. Let's first go to our demo. And notice, here, that the teapot moves around. So I can start and I can stop the animation. I'm pressing the p key on my keyboard in order to start and stop the animation. And notice that I can move in, move out, zoom, zoom out, while the animation is going on. Let's now talk about the code that you need to write in order for this to happen. First we're going to use this glColor3f command in order to set the color. And notice that the color involves green and blue so it's cyan. We then push the matrix onto the stack, and again, this is a deprecated command to set the translation by the teapot location. Then we have the sequence of steps. Remember that, in OpenGL, the last transform in the code, is actually the first one that's applied. So you take the teapot, you rotate it by 90 degrees about the X-axis, and then you translate it 0.1 in the Z-axis. This is required in order to get it in the right orientation, in the right position on the screen. Then we translated by this teapotloc command. This is a drawing command for the teapot, this gives the radius. And again, you push and pop around this entire block so that you don't affect other geometry. The animation routine is very simple. It just increments the teapot location, and if it goes off the right edge of the screen, it resets it to the left edge. Remember that the glutPostRedisplay command tells OpenGL and GLUT to call the display routine as soon as it can in order to update. Finally there is a keyboard callback, where p is used to pause the animation. And this keyboard callback is very simple. If you are animate, then GLUT idle function is set to animation. GLUT idle function is called when nothing else is going on when the program is idle. Otherwise you set the GLUT idle function to null, in which case nothing is happening. And this is a simple toggle of animate; so, just toggle it on and off when I press B. So, with this simple mechanism, you can have pre-baked animations where they animate while the program is idle.