rem: gwin->setWinID(winid);
add: gwin->setId(winid);
context: int main(int argc, char **argv){//    enableFPE();#ifdef __sgi 		signal(SIGSEGV, (void (*)(int))sighand);	signal(SIGTRAP, (void (*)(int))sighand);	signal(SIGBUS, (void (*)(int))sighand);#endif       // OSG init    osgInit(argc,argv);    if (argc > 1 && ! strcmp(argv[1],"-bench"))    {        runBench = true;        argc--;        argv++;        glutInitWindowPosition(0,0);        glutInitWindowSize(600,600);    }    if (argc > 1 && ! strcmp(argv[1],"-test"))    {        testSet = true;        argc--;        argv++;    }    // GLUT init    int winid = setupGLUT(&argc, argv);    // the connection between GLUT and OpenSG    GLUTWindowPtr gwin= GLUTWindow::create();    gwin->setWinID(winid);    gwin->init();    // create the scene    NodePtr scene = Node::create();        NodePtr pnode = Node::create();        ComponentTransformPtr trans = ComponentTransform::create();    beginEditCP(scene);    scene->setCore(trans);    scene->addChild(pnode);    endEditCP(scene);        beginEditCP(trans);    trans->setTranslation(Vec3f(2,0,0));    trans->setRotation(Quaternion(Vec3f(0,1,0),Pi/2));//    trans->setScale(Vec3f(2,2,2));    endEditCP(trans);            particles = Particles::create();    beginEditCP(pnode);    pnode->setCore(particles);    endEditCP(pnode);    numParticles = 100;        if (argc > 1)    {        numParticles=atoi(argv[1]);    }        beginEditCP(particles);    pnts=GeoPositions3f::create();    secpnts=GeoPositions3f::create();    GeoColors3fPtr  cols  = GeoColors3f::create();    GeoNormals3fPtr norms = GeoNormals3f::create();    MFPnt3f* p=pnts->getFieldPtr();    MFPnt3f* sp=secpnts->getFieldPtr();    MFVec3f *size=particles->getMFSizes();    indices = particles->getMFIndices();        velocities=new Vec3f [numParticles];        beginEditCP(pnts);    beginEditCP(secpnts);    beginEditCP(cols);    if(!testSet)    {        for(UInt32 i=0; i < numParticles; ++i)        {            Pnt3f pnt(osgrand(),osgrand(),osgrand());            indices->addValue(i);              p->addValue(pnt);              sp->addValue(pnt);              velocities[i].setValues(osgrand()/30.f/2, osgrand()/30.f/2, osgrand()/30.f/2);            cols->getFieldPtr()->addValue(                 Color3f(osgrand()/2.f + .5f,osgrand()/2.f + .5f,osgrand()/2.f + .5f) );            size->addValue(                Vec3f(osgrand()/20.f+0.05,osgrand()/20.f+0.05,osgrand()/20.f+0.05));        }    }    else    {        Pnt3f   tpos[] =         { Pnt3f(.5,.5,.5), Pnt3f (.5,.5,.7), Pnt3f(.5,.5,.9), Pnt3f(.7,.5,.5),           Pnt3f(.5,.7,.5), Pnt3f (-1000,-1000,-1000) };                Pnt3f   tsecpos[] =         { Pnt3f(0,0,0), Pnt3f(0,0,0), Pnt3f(0,0,0), Pnt3f(0,0,0),           Pnt3f(0,0,0) };                Vec3f   tvel[] =         { Vec3f(0,0,0), Vec3f(0,0,0), Vec3f(0,0,0), Vec3f(0,0,0),           Vec3f(0,0,0) };                Color3f tcol[] =         { Color3f(1,0,0), Color3f(0,1,0), Color3f(0,0,1), Color3f(1,1,0),           Color3f(1,0,1), Color3f(0,1,1), Color3f(1,1,1) };                Vec3f   tsize[] =         { Vec3f(.1,0,0), Vec3f(.1,0,0), Vec3f(.1,0,0), Vec3f(.1,0,0),           Vec3f(.1,0,0) };        for(UInt32 i=0; tpos[i][0] > -1000; ++i)        {            indices->addValue(i);              p->addValue(tpos[i]);              sp->addValue(tsecpos[i]);              velocities[i].setValue(tvel[i]);            cols->getFieldPtr()->addValue(tcol[i]);            size->addValue(tsize[i]);        }           }    endEditCP(pnts);    endEditCP(secpnts);    endEditCP(cols);    beginEditCP(norms);    norms->addValue(Vec3f(0,1,0));    endEditCP(norms);    particles->setPositions( pnts );    particles->setSecPositions( secpnts );    particles->setColors( cols );    particles->setNormals( norms );                        endEditCP(particles);     // set volume static to prevent constant update    beginEditCP(pnode, Node::VolumeFieldMask);    Volume &v=pnode->getVolume().getInstance();    v.setEmpty();    v.extendBy(Pnt3f(0,0,0));    v.extendBy(Pnt3f(1,1,1));    v.setStatic();    endEditCP  (pnode, Node::VolumeFieldMask);      SimpleTexturedMaterialPtr tm;    tm = SimpleTexturedMaterial::create();    UChar8 imgdata[] =        {  255,255,255,  255,0,0,  255,0,255,           255,0,0,  255,0,0,  255,255,255 };    Image image;    if (argc > 2)    {        image.read(argv[2]);    }    else    {        image.set(Image::OSG_RGB_PF, 3, 2, 1, 1, 1, 0, imgdata);    }        beginEditCP(tm);    tm->setDiffuse( Color3f( 1,1,1 ) );    tm->setLit( false );    tm->setImage( &image );    tm->setEnvMode( GL_MODULATE );        BlendChunkPtr bl=BlendChunk::create();        beginEditCP(bl);    bl->setSrcFactor(GL_SRC_ALPHA);    bl->setDestFactor(GL_ONE_MINUS_SRC_ALPHA);#if 0    bl->setAlphaFunc(GL_EQUAL);    bl->setAlphaValue(1);   #endif    endEditCP(bl);       tm->addChunk(bl);        endEditCP(tm);    particles->setMaterial( tm );#if 0    // write it, just for testing    std::ofstream out("test.osg");    OSGWriter w(out);        w.write(scene);    #endif    // create the SimpleSceneManager helper    mgr = new SimpleSceneManager;    // tell the manager what to manage    mgr->setWindow(gwin );    mgr->setRoot  (scene);    // show the whole scene    mgr->showAll();    mgr->setHighlight(scene);        // GLUT main loop    glutMainLoop();    return 0;}