No object drawn in 2nd window

main()
{

a=window 1;

b=window2;
set a;
draw()

set b
draw();

}

draw()
{

}

my code is something like that.
I uesd the same draw function in both the windows( both the window has different view points)

object is drawn in the 1st one but not the second. fuction call works perfectly(checked it with a “draw” line apart from the object. line was drawn but not the object.)

related
while doing a different task I tried to calll the draw function second time in one window(kinda redrawing the object). nothing drawn in the window.(rest of them-function call, control transfers work perfectly)

my questions are

  1. how to get the object in the second window
  2. can i use the same drawing function in different windows
  3. if i use glutPostRedisplay() what are the things will be updated in main program and screen(ex. which functions will be called, what variables are updated etc.)

Many Thanks
Mil

I wrote a little dual windows program in glut yet to post it on my website.

But I am guessing you have not set you window to be drawn to correctly.

Yes, you can have both windows share functions.

Here is how you have to setup each window, if you would like a copy of the full working source code drop me an e-mail, make sure “openGL forum” is in the subject line else it may get deleted as spam.

// Main program
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutTimerFunc( 10, TimeEvent, 1);
glutInitWindowSize (500, 500);
glutInitWindowPosition (10, 10);
window_1 = glutCreateWindow (argv[0]);
glutSetWindowTitle(“GlutWindow 1”);
glutDisplayFunc(display_1);
glutReshapeFunc(reshape_1);
glutKeyboardFunc(keyboard);
glutPassiveMotionFunc( entry_1 );
init ();
window_2 = glutCreateWindow (argv[0]);
glutSetWindowTitle(“GlutWindow 2”);
glutPassiveMotionFunc( entry_2 );
glutDisplayFunc(display_2);
glutReshapeFunc(reshape_2);
init ();
glutMainLoop();
return 0;
}