My situation is that I have a subwindow in mainwindow which creates another subwindow in mainwindow. The second subwindow provides a template for inputting data. Upon completion of data entry, I destroy both windows.
Code :
  else if(btn == GLUT_LEFT_BUTTON && state == GLUT_DOWN){
    for(i= NSubWindows-1; i >= 0; i--){
      if(subWindow[i]){
	glutDestroyWindow(subWindow[i]);
	if(i < windowlevel) windowlevel = i;
	subWindow[i] = 0;
      }
    }
The first invocation works flawlessly: subWindow[0] = 4; subWindow[1] = 5.
The next invocation creates subWindow[0] = 6 and subWindow[1] = 7. The text is correctly written into the window, but the glBegin(GL_QUADS) stuff (7 text boxes) is missing. Also, the location of the subwindow is other than as speccified.
I read somewhere that it is preferable to hide subwindows rather than create and destroy at need. That may ultimately be the answer.

Is this a known problem? Shoudl I be looking for some other problem?