Using Sub Windows in OpenGL

I need to create a program that has 6 sub windows, all of which have the same scene just from different view points. I have created these subwindows in main labeled win1, win2, etc. When I go into my display function, I wanted to do something like:

glutSetWindow(win1);
gluLookAt(…);
drawscene();

glutSetWindow(win2);
etc.

For some reason, the only thing that will get drawn on the screen is the very last window that gets called by glutSetWindow(). Is there any good way to do this, or should I just create a seperate display function for each sub window?

You can have each function share the same routine, just make sure you define it each time.

Now here is a bit of my code, I have made duplicate routines for each window function.

window_1 = glutCreateWindow (argv[0]);
glutSetWindowTitle(“GlutWindow 1”);
init ();
glutDisplayFunc(display_1);
glutReshapeFunc(reshape_1);
glutKeyboardFunc(keyboard);

window_2 = glutCreateWindow (argv[0]);
glutSetWindowTitle(“GlutWindow 2”);
init ();
glutDisplayFunc(display_2);
glutReshapeFunc(reshape_2);
glutMainLoop();

One thing I did was you the glutTimerFunction to update each window.

void My_timer(int t)
{
glutSetWindow(win_1);
glutPostRedisplay();

glutSetWindow(win_2);
glutPostRedisplay();

}

hope this helps.

Originally posted by bonzovt:
[b]I need to create a program that has 6 sub windows, all of which have the same scene just from different view points. I have created these subwindows in main labeled win1, win2, etc. When I go into my display function, I wanted to do something like:

glutSetWindow(win1);
gluLookAt(…);
drawscene();

glutSetWindow(win2);
etc.

For some reason, the only thing that will get drawn on the screen is the very last window that gets called by glutSetWindow(). Is there any good way to do this, or should I just create a seperate display function for each sub window?[/b]

That helps a bit. Looking at your code I realized that I only had this code once at the end of my display function:

glutSwapBuffers();
glutPostRedisplay();

That is why only one window was showing up. I put that into my drawscene() func, so now they are all showing up, but each subwindow also flashes with the scene showing up in different areas. Is that why you used the glutTimerFunc to draw the scene…to get rid of that constant redrawing of different scenes? Thanks for the help!