PDA

View Full Version : multiple windows in opengl



11-28-2002, 03:28 PM
How do I make multiple windows in opengl, and how do I address them later when I need to update either one?

[This message has been edited by hmm (edited 11-28-2002).]

prashantgp
11-28-2002, 06:03 PM
hi HMM,
i hope u know how to create the first window.
it is something like this.

int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitWindowSize(1200,900);
glutInitWindowPosition(0,0);
pw=glutCreateWindow(" opening first ");
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB );
init();

glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
glutMainLoop();
return 0;
}


here glutCreateWindow returns the window identifier pw.(parent window).

now u can create another subwindow using another glut call,
cw=glutCreateSubWindow(pw,160,120,830,630);

where in u've to pass the pw to the function.

this window can be set using ,
glutSetWindow(cw);

i hope this is what u want. like one msin window and later on subwindows.

if u r not looking for this and want to divide ur screnn in to 4 different windows ,u can go for glViewPort().

hope this helps.