PDA

View Full Version : glut multiple windows general



true_atlantis
09-03-2005, 04:29 PM
when i create 3 windows using glut like this


for(int i=0;i<3;i++){
glutInitWindowSize(300,300);
glutInitWindowPosition(310*i,0);
int x = glutCreateWindow("View");
winid[i]=x;
}it will create the 3 windows... but if i try to select one, by doing


glutSetWindow(winid[0]); it will not work... the only window that can be accessed is the last one created. is there some sort of initialization so there can be more than one window?

Hlz
09-03-2005, 09:23 PM
Try setting each window after it's created, then set your callbacks. Works fine for me, though I've not really played with it much.
http://www.opengl.org/resources/libraries/glut/spec3/spec3.html

true_atlantis
09-04-2005, 02:21 PM
im not sure i understand exactly what you mean... do you mean

for(int i=0;i<3;i++){
glutInitWindowSize(300,300);
glutInitWindowPosition(310*i,0);
int x = glutCreateWindow("View");
winid[i]=x;
glutSetWindow(winid[0]);
}

Hlz
09-04-2005, 03:19 PM
Pretty much, but you need to supply callbacks for each window you create.


for( int i = 0; i < 3; i++ )
{
glutInitWindowSize(300,300);
glutInitWindowPosition(310*i,0);
glutCreateWindow("View");

glutReshapeFunc( reshape );
glutDisplayFunc( display );
// ...
}