hi, i am using opengl and glut…
i created two opengl windows, one to run animation and the other to just do normal stuff like rotate models and stuff
to start up the program the first window displays the models and buttons…a click of the runAnimation button(…buttoncallback8…)…creates the second window…and peforms the animation…exiting this second window takes me back to the first window…
the problem is when i am back to the first window i can no longer use the keyboard functions again
does anyone know what might be causing this problem…please i need your help.
static void TheButtonCallback8()
{
animate=true;
window2=0;
if(window2==0){
loadMast = true;
loadReflector = true;
loadReceiver = true;
loadConnector = true;
loadStand = true;
window2 = glutCreateWindow("animation");
glutDisplayFunc(display2);
glutReshapeFunc(animation_Reshape);
glutIdleFunc(OnIdle1);
glutSpecialFunc (keyboard_s);
glutKeyboardFunc(OnKeyAnimation);
//glutMouseFunc(Mouse);
//glutMotionFunc(Motion);
InitGL();
glutMainLoop();
}else{
glutDestroyWindow(window2);
window2=1;}
printf("Run Animation");
}
void main(int argc, char** argv) {
atexit(OnShutdown);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize(width, height);
//glutCreateWindow("SATELLITE DISH ASSEMBLY");
window1 = glutCreateWindow("Satellite Assembly");
glutDisplayFunc(OnRender);
glutReshapeFunc(OnReshape);
glutIdleFunc(OnIdle);
glutKeyboardFunc(OnKey);
glutSpecialFunc (keyboard_s);
glutMouseFunc(Mouse);
glutMotionFunc(Motion);
glutPassiveMotionFunc(MousePassiveMotion);
InitGL();
glutMainLoop();
}
void OnKeyAnimation(unsigned char key, int x, int y){
if (key == 27){
glutDestroyWindow(window2);
animate=false;
loadMast= false;
loadReflector= false;
loadReceiver= false;
loadConnector= false;
loadStand= false;
//exit(0);
}
}
thank you