Ejemplo n.º 1
0
void keyboard( unsigned char key, int x, int y ) {

    switch( key ) {

	// automated animation
        case 'a': animate(); break;

	// incremental rotation along the axes
        case 'x': angles[0] -= angleInc; break;
        case 'y': angles[1] -= angleInc; break;
        case 'z': angles[2] -= angleInc; break;
        case 'X': angles[0] += angleInc; break;
        case 'Y': angles[1] += angleInc; break;
        case 'Z': angles[2] += angleInc; break;

    // add/remove
        case '1': scene.Add(&r1); break;
        case '2': scene.Add(&r2); break;
        case '3': scene.Del(&r1); break;
        case '4': scene.Del(&r2); break;

	// termination
        case 033:  // Escape key
        case 'q': case 'Q':
            exit( 0 );
    }

    glutPostRedisplay();
}