redrawing multiple glut windows
I'm working on an electroplankton clone for school and I want to have a 3d window where I can have everything rendering and a 2d for all the gui to sit in. I register the second window with a glutCreateWindow() call and the same set of callback functions so that I can process both windows without having to change my scene graph (this still needs to fit together with the parts my teammates are making).
The problem is that the two windows render the way they're supposed to, but only when they're the active window or the mouse is over them. I tried fixing this by putting this code at the end of the two render functions, respectively:
Code:
//at end of edit window render function
glutSetWindow(mainWindowID);
glutPostRedisplay();
glutSetWindow(editWindowID);
Code:
//at end of main window render function
glutSetWindow(editWindowID);
glutPostRedisplay();
glutSetWindow(mainWindowID);
This works by making one window rendering trigger the render call for the other one for a while, but after a minute or so it always crashes and stops drawing. Is there another way to work around this that anybody knows of?