I’m trying to render multiple windows with a different object in each window. When exploring this in GLUT, I found that you can open multiple windows and then assign a callback to each window when it is the current window. I currently can open two windows and draw two different squares but the one window doesn’t seem to update unless I click the window. I am changing the colors of each square slowly to check the updating, and the one correctly changes but the other will not change at all unless I click the opposite window then click back to the non-rendering window. Then the color changes but not gradually, just to the other color.
I can’t find any help on this topic but I believe that I am just making a small mistake.
int window1, window2;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB |GLUT_DEPTH);
glutInitWindowSize(500, 500);
// create the first window
window1 = glutCreateWindow(“First Window - Perspective View”);
// register callbacks for first window, which is now current
glutReshapeFunc(window1_reshape);
glutDisplayFunc(window1_display); // window1_display
glutMouseFunc(window1_mouse);
//create the second window
window2 = glutCreateWindow(“Second Window - Top/Down View”);
//define a window position for second window
glutPositionWindow(520,20);
// register callbacks for second window, which is now current
glutReshapeFunc(window2_reshape);
glutDisplayFunc(window2_display);
glutMouseFunc(window2_mouse); //note we share the mouse function
glutIdleFunc(idle_func); //idle function is not associated with a
init();
glutMainLoop();
return 0;
}