rem: gwin->setWinID(winID);
add: gwin->setId(winID);
context: int main (int argc, char **argv){    osgInit( argc, argv );    glutInit( &argc, argv );    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );    int winID = glutCreateWindow("OpenSG");    Real32 creaseAngle = deg2rad(45);    if(argc > 1)    {        if(sscanf(argv[1], "%f", &creaseAngle) != 1)        {            creaseAngle = deg2rad(45);        }        else        {            creaseAngle = deg2rad(creaseAngle);        }    }    glutKeyboardFunc(key);    glutVisibilityFunc(vis);    glutReshapeFunc(resize);    glutDisplayFunc(display);           glutMouseFunc(mouse);       glutMotionFunc(motion);     glutIdleFunc(display);    glEnable( GL_DEPTH_TEST );    glEnable( GL_LIGHTING );    glEnable( GL_LIGHT0 );    glClearColor( .1, .6, .2, 1 );    //glCullFace( GL_BACK );    //glEnable( GL_CULL_FACE );    //BEACON    NodePtr beaconNode = Node::create();    GroupPtr beaconCore = Group::create();    beginEditCP( beaconNode );    beaconNode->setCore( beaconCore );    endEditCP( beaconNode );    //TRANSFORM    NodePtr transNode = Node::create();    TransformPtr transCore = Transform::create();    beginEditCP( transNode );    transNode->setCore( transCore );    transNode->addChild( beaconNode );    endEditCP( transNode );    cam_trans = transCore;    //OBJECT0: Plane    objects[0] = makeBox( 3,3,2, 2,2,1 );    calcVertexNormals( GeometryPtr::dcast(objects[0]->getCore()), creaseAngle );    normals[0] = getNormals( GeometryPtr::dcast(objects[0]->getCore()), 0.5 );    //OBJECT1: Sphere    objects[1] = makeSphere( 2, 2 );    calcVertexNormals( GeometryPtr::dcast(objects[1]->getCore()), creaseAngle );    normals[1] = getNormals( GeometryPtr::dcast(objects[1]->getCore()), 0.5 );    //OBJECT2: Cone    objects[2] = makeConicalFrustum( 1.5, 0.75, 2, 8, true, true, true );    calcVertexNormals( GeometryPtr::dcast(objects[2]->getCore()), creaseAngle );    normals[2] = getNormals( GeometryPtr::dcast(objects[2]->getCore()), 0.5 );    //OBJECT3: Create stairs with increasing angles    UInt16 nsteps = 19;    Real32 delta  = 2.f / nsteps;     objects[3] = Node::create();    GeometryPtr obj3Core= Geometry::create();    GeoIndicesUI32Ptr obj3Index = GeoIndicesUI32::create();    GeoPositions3f::PtrType obj3Pnts = GeoPositions3f::create();    GeoPTypesPtr obj3Types = GeoPTypesUI8::create();    GeoPLengthsPtr obj3Lengths = GeoPLengthsUI32::create();    beginEditCP( obj3Pnts );    for(UInt16 x=0; x<nsteps; x++)    {        obj3Pnts->addValue(Pnt3f( x       * delta - 1, -delta, 0 ));        obj3Pnts->addValue(Pnt3f((x + .9) * delta - 1, -delta, 0 ));        obj3Pnts->addValue(Pnt3f( x       * delta - 1,      0, 0 ));        obj3Pnts->addValue(Pnt3f((x + .9) * delta - 1,      0, 0 ));        Real32 s = osgsin((x * Pi) / (2 * (nsteps - 1))) * delta;        Real32 c = osgcos((x * Pi) / (2 * (nsteps - 1))) * delta;        obj3Pnts->addValue(Pnt3f( x       * delta - 1,      c, 0 - s));        obj3Pnts->addValue(Pnt3f((x + .9) * delta - 1,      c, 0 - s));    }    beginEditCP( obj3Types );    obj3Types->addValue( GL_QUADS );    endEditCP( obj3Types );    beginEditCP( obj3Lengths );    obj3Lengths->addValue( 8 * nsteps );    endEditCP( obj3Lengths );    beginEditCP( obj3Index );    for(UInt16 i=0; i<nsteps; ++i)    {        obj3Index->addValue( i * 6     );        obj3Index->addValue( i * 6 + 1 );        obj3Index->addValue( i * 6 + 3 );        obj3Index->addValue( i * 6 + 2 );        obj3Index->addValue( i * 6 + 2 );        obj3Index->addValue( i * 6 + 3 );        obj3Index->addValue( i * 6 + 5 );        obj3Index->addValue( i * 6 + 4 );    }    endEditCP( obj3Index );    beginEditCP( obj3Core );    obj3Core->setIndices( obj3Index );    obj3Core->setPositions( obj3Pnts );    obj3Core->setTypes( obj3Types );    obj3Core->setLengths( obj3Lengths );    obj3Core->setMaterial( getDefaultMaterial() );    endEditCP( obj3Core );    beginEditCP( objects[3] );    objects[3]->setCore( obj3Core );    endEditCP( objects[3] );    calcVertexNormals( GeometryPtr::dcast(objects[3]->getCore()), creaseAngle );    normals[3] = getNormals( GeometryPtr::dcast(objects[3]->getCore()), delta );    //ROOT    root = Node::create();    GroupPtr rootCore = Group::create();    beginEditCP(root);    root->setCore(rootCore);    root->addChild(transNode);    root->addChild(objects[0]);    root->addChild(normals[0]);    activeObj = root->findChild( objects[0] );    activeNorm = root->findChild( normals[0] );    endEditCP(root);    camera = PerspectiveCamera::create();    camera->setBeacon( beaconNode );    camera->setFov( 90 );    camera->setNear( 0.1 );    camera->setFar( 10000 );    SolidBackgroundPtr background = SolidBackground::create();    viewp = Viewport::create();    viewp->setCamera( camera );    viewp->setBackground( background );    viewp->setRoot( root );    viewp->setSize( 0,0, 1,1 );    GLint glVP[4];    glGetIntegerv( GL_VIEWPORT, glVP );    GLUTWindowPtr gwin = GLUTWindow::create();    gwin->setWinID(winID);    gwin->setSize(glVP[2], glVP[3]);    window = gwin;    window->addPort( viewp );    window->init();    drAct = DrawAction::create();    Vec3f pos( 0, 0, 3 );    tball.setMode( Trackball::OSGObject );    tball.setStartPosition( pos, true );    tball.setSum( true );    tball.setTranslationMode( Trackball::OSGFree );    glutMainLoop();    return 0;}