rem: sky->getMFSkyColor()->addValue(Color3f(0, 0, 1)); sky->getMFSkyAngle()->addValue(Pi / 4); sky->getMFSkyColor()->addValue(Color3f(0, 1, 0)); sky->getMFSkyAngle()->addValue(Pi / 2); sky->getMFSkyColor()->addValue(Color3f(1, 0, 0));
add: sky->getMFSkyColor()->push_back(Color3f(0, 0, 1)); sky->getMFSkyAngle()->push_back(Pi / 4); sky->getMFSkyColor()->push_back(Color3f(0, 1, 0)); sky->getMFSkyAngle()->push_back(Pi / 2); sky->getMFSkyColor()->push_back(Color3f(1, 0, 0));
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);      // 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->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);    // Load the file    NodePtr file = SceneFileHandler::the().read(argv[1]);    file->updateVolume();    // should check first. ok for now.    const BoxVolume *vol = (BoxVolume *)&file->getVolume();    Vec3f min,max;    vol->getBounds( min, max );        cout << "Volume: from " << min << " to " << max << endl;    beginEditCP(dlight);    dlight->addChild( file );    endEditCP(dlight);        // Camera    PerspectiveCameraPtr cam = PerspectiveCamera::create();    cam->setBeacon( b1n );    cam->setFov( Pi/2 );    cam->setNear( 1 );    cam->setFar( 100000 );    // Background    SkyBackgroundPtr sky = SkyBackground::create();    beginEditCP(sky);    sky->setSphereRes(16);    sky->getMFSkyColor()->addValue(Color3f(0, 0, 1));    sky->getMFSkyAngle()->addValue(Pi / 4);    sky->getMFSkyColor()->addValue(Color3f(0, 1, 0));    sky->getMFSkyAngle()->addValue(Pi / 2);    sky->getMFSkyColor()->addValue(Color3f(1, 0, 0));     sky->getMFGroundColor()->addValue(Color3f(0, 1, 1));    sky->getMFGroundAngle()->addValue(Pi / 8);    sky->getMFGroundColor()->addValue(Color3f(1, 0, 1));    sky->getMFGroundAngle()->addValue(Pi / 4);    sky->getMFGroundColor()->addValue(Color3f(1, 1, 1));    UChar8 imgdata[] =         {  255,0,0,128,  0,255,0,128,  0,0,255,255,  255,255,255,255 };    Image image( Image::OSG_RGBA_PF, 2, 2, 1, 1, 1, 0, imgdata );    if ( argc > 2 )        image.read( argv[2] );        TextureChunkPtr tex1;    tex1 = TextureChunk::create();    tex1->setImage( &image );    tex1->setMinFilter( GL_NEAREST );    tex1->setMagFilter( GL_NEAREST );    tex1->setWrapS( GL_REPEAT );    tex1->setEnvMode( GL_REPLACE );        sky->setBackTexture(tex1);//    sky->setFrontTexture(tex1);    sky->setLeftTexture(tex1);    sky->setRightTexture(tex1);    sky->setBottomTexture(tex1);//    sky->setTopTexture(tex1);     endEditCP  (sky);    // Viewport    ViewportPtr vp = Viewport::create();    vp->setCamera( cam );    vp->setBackground( sky );    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] );    gwin->init();    win = gwin;    win->addPort( vp );    // Action        ract = DrawAction::create();    // tball    Vec3f pos( 0, 0, max[2] + ( max[2] - min[2] ) * 1.5 );    tball.setMode( Trackball::OSGObject );    tball.setStartPosition( pos, true );    tball.setSum( true );    tball.setTranslationMode( Trackball::OSGFree );    // run...    glutMainLoop();        return 0;}