rem: cout << "GLUT winid: " << winid << endl;
add: std::cout << "GLUT winid: " << winid << std::endl;
context: int main (int argc, char **argv){    osgInit(argc,argv);    // GLUT init    glutInit(&argc, argv);    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);    int winid = glutCreateWindow("OpenSG");    glutKeyboardFunc(key);    glutVisibilityFunc(vis);    glutReshapeFunc(reshape);    glutDisplayFunc(display);           glutMouseFunc(mouse);       glutMotionFunc(motion);         glutIdleFunc(display);          glEnable( GL_DEPTH_TEST );    glEnable( GL_LIGHTING );    // create the graph    // beacon for camera and light      NodePtr b1n = Node::create();    GroupPtr b1 = Group::create();    beginEditCP(b1n);    b1n->setCore( b1 );    endEditCP(b1n);    // transformation    NodePtr t1n = Node::create();    TransformPtr t1 = Transform::create();    beginEditCP(t1n);    t1n->setCore( t1 );    t1n->addChild( b1n );    endEditCP(t1n);    cam_trans = t1;    // light        NodePtr dlight = Node::create();    DirectionalLightPtr dl = DirectionalLight::create();    beginEditCP(dlight);    dlight->setCore( dl );    endEditCP(dlight);        beginEditCP(dl);    dl->setAmbient( .3, .3, .3, 1 );    dl->setDiffuse( 1, 1, 1, 1 );    dl->setSpecular( 1, 1, 1, 1 );    dl->setDirection(0,0,1);    dl->setBeacon( b1n);    endEditCP(dl);        // root    root = Node::create();    GroupPtr gr1 = Group::create();    beginEditCP(root);    root->setCore( gr1 );    root->addChild( t1n );    root->addChild( dlight );    endEditCP(root);    // Create the test geometry        if ( argc >= 2 )    {        georoot = SceneFileHandler::the().read(argv[1], 0);    }    else    {        georoot = Node::create();        gr1 = Group::create();        beginEditCP(georoot);        georoot->setCore( gr1 );        endEditCP(georoot);        SimpleMaterialPtr mat = SimpleMaterial::create();        beginEditCP(mat);        mat->setDiffuse( Color3f( 1,0,0 ) );        mat->setAmbient( Color3f( 1,0,0 ) );        mat->setSpecular( Color3f( 1,1,1 ) );        mat->setShininess( 10 );        endEditCP(mat);        GeometryPtr sphere = makeSphereGeo( 2, 1 );        beginEditCP(sphere);        sphere->setMaterial( mat );        endEditCP(sphere);        // create a bunch of instances, moved by transforms        beginEditCP(georoot);        for ( int x = -10; x < 10; x += 2)        {            // reuse the geometry            NodePtr gn = Node::create();                    beginEditCP(gn);            gn->setCore( sphere );            endEditCP(gn);            // the transform to move it            NodePtr tn = Node::create();            ComponentTransformPtr t = ComponentTransform::create();            beginEditCP(tn);            tn->setCore( t );            tn->addChild( gn );            endEditCP(tn);            beginEditCP(t);            t->setTranslation( Vec3f( x, 0, 0 ) );            endEditCP(t);            // add it to the georoot            georoot->addChild( tn );        }        endEditCP(georoot);    }        Vec3f min,max;    georoot->getVolume().getBounds( min, max );        cout << "Volume: from " << min << " to " << max << endl;    beginEditCP(dlight);    dlight->addChild( georoot );    endEditCP(dlight);    // Camera        cam = PerspectiveCamera::create();    cam->setBeacon( b1n );    cam->setFov( deg2rad( 90. ) );    cam->setNear( 0.1 );    cam->setFar( 10000 );    // Background    SolidBackgroundPtr bkgnd = SolidBackground::create();    // Viewport    vp = Viewport::create();    vp->setCamera( cam );    vp->setBackground( bkgnd );    vp->setRoot( root );    vp->setSize( 0,0, 1,1 );    // Window    cout << "GLUT winid: " << winid << endl;    GLUTWindowPtr gwin;    GLint glvp[4];    glGetIntegerv( GL_VIEWPORT, glvp );    gwin = GLUTWindow::create();    gwin->setId(winid);    gwin->setSize( glvp[2], glvp[3] );    win = gwin;    win->addPort( vp );    win->init();    // Action        ract = DrawAction::create();        ract->setAutoFrustum( true );        // tball    Vec3f pos( 0, 0, 5 );    tball.setMode( Trackball::OSGObject );    tball.setStartPosition( pos, true );    tball.setSum( true );    tball.setTranslationMode( Trackball::OSGFree );    // run...        glutMainLoop();        return 0;}