i used glut to creat 2 windows and wanted to display different interactive display function. i wrote :
{
glutMouseFunc(mouseEvent);
glutMotionFunc(mouseActiveMotion);
glutReshapeFunc(reshape);
glutDisplayFunc(depthdisplay);
glutIdleFunc(depthdisplay);
}
So you’re talking about glut, then?
As far as I’m aware, there is no such thing as a glut ‘object’ or a glut ‘handle’ so you probably won’t be able to create 2 glut windows. I’m probably wrong, though - I don’t think I’ve ever actually used glut… it always seemed a little limited to me.
Does your application have to work on anything other than Microsoft Windows?
If no, then just hijack any old windows WndProc and create your opengl contexts in there. There’s plenty of tutorials on how to do this on the internet.
Works fine for me to create two independent windows in GLUT. They can share the same callback functions if they want (like the reshape function in my example).
Just noticed something. You have a display function in the idle callback. The display function should go in the display callback only. GLUT doesn’t have separate idle functions for each window. Use glutPostRedisplay in the idle function to redisplay your scene.
thanks for reply. I delete the glutIdleFuc and Add glutPostRedisplay in every display fuction. now they can show different things in every window. But new problem appears. if i change things in one window by mouse, all of the others change also. my original problem is that the same thing appears in every window, but if i change things in one window, all of the others don’t change . I tryed several ways, but can not find solution. is it possible to show different things in several window,and change by mouse in one window don’t influence other windows?