void redisplay_all(void) { glutSetWindow(command); glutPostRedisplay(); glutSetWindow(world); world_reshape(sub_width, sub_height); glutPostRedisplay(); glutSetWindow(screen); screen_reshape(sub_width, sub_height); glutPostRedisplay(); }
void keyboard(unsigned char key, int x, int y) { switch (key) { //Wire frame or Shaded Model case 'w': case 'W': WireFrame = 1-WireFrame; if (WireFrame) glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); // Solid else glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); // Wireframes break; //Camera forward case 'f': //glMatrixMode(GL_MODELVIEW); glLoadIdentity(); eyez -= 1.5f; gluLookAt(eyex, eyey, eyez, 0, 0, 0, 0, 1, 0); break; //Camera backward case 'b': glLoadIdentity(); eyez += 1.5f; gluLookAt(eyex, eyey, eyez, 0, 0, 0, 0, 1, 0); break; //Zoom in case 'z': angle -=2.0; default_reshape(width, height); break; //Zoom out case 'Z': angle +=2.0; default_reshape(width, height); break; //Perspective View case 'p': case 'P': mode = PERSPECTIVE; screen_reshape(width, height); break; //Orthographic View case 'o': case 'O': mode = ORTHO; screen_reshape(width, height); break; //fog control case '0': fog = !fog; break; //Light control case '1': light0 = !light0; //Cannnon spot light light1 = !light1; //sun light spotlight = !spotlight; //Target spot light map.skyChange = !map.skyChange; //Change to night sky break; //camera control case '2': camera = !camera; break; case '3': spotlightChange = !spotlightChange; break; //animation control case ' ': allBullets.push_back(Bullet(cannon1.CannonPoz,cannon1.turn,cannon1.beta)); break; //Gun control case '[': cannon1.Gun(UP); break; //Gun control case ']': cannon1.Gun(DOWN); break; //smoke control case 's': //smoke = !smoke; break; case '/': glutFullScreen(); break; case 'i': cameraX += 5.0f; break; case 'k': cameraX -= 5.0f; break; case 'j': cameraY -= 10.0f; break; case 'l': cameraY += 10.0f; break; //Clear viewing parameter case 'c': case 'C': cameraX = 0.0f; cameraY = 0.0f; cameraZ = 0.0f; eyex = 0.0f; eyey = 10.0f; eyez = 35.0f; angle = 50.0f; default_reshape(width, height); break; //Exit from the program, by pressing "Esc" key. case 27: exit(0); break; } glutPostRedisplay(); }