rem: BackgroundPtr bkgnd = Background::create();
add: SolidBackgroundPtr bkgnd = SolidBackground::create();
context: int main (int argc, char **argv){    int dummy;	// OSG init    osgInit(argc, argv);#ifdef WIN32    RAWSceneFileType *pR = &(RAWSceneFileType::staticThe());#endif    SceneFileHandler::the().print();	// 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->setAmbientColor( .3, .3, .3, 1 );	dl->setDiffuseColor( 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 = NullNode;		if ( argc > 1 )		file = SceneFileHandler::the().read(argv[1]);		if ( file == NullNode )	{		cerr << "Couldn't load file, ignoring" << endl;		file = makeTorus( .5, 2, 16, 16 );	}		file->updateVolume();	Vec3f min,max;	file->getVolume().getBounds( min, max );		cout << "Volume: from " << min << " to " << max << endl;	beginEditCP(dlight);	dlight->addChild( file );	endEditCP(dlight);	cerr << "Tree: " << endl;	root->dump();	// Camera	PerspectiveCameraPtr cam = PerspectiveCamera::create();	cam->setBeacon( b1n );	cam->setDegrees( 60 );	cam->setNear( 0.1 );	cam->setFar( 10000 );	// Background	BackgroundPtr bkgnd = Background::create();		// Viewport		ViewportPtr vp = Viewport::create();	vp->setCamera( cam );	vp->setBackground( bkgnd );	vp->setRoot( root );	vp->setSize( 0,0, 1,1 );	// 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 );	// X init    dpy = XOpenDisplay(NULL);    if (dpy == NULL)     {	    cerr << "Error: Could not open display!" << endl;    }    if( ! glXQueryExtension( dpy, &dummy, &dummy ) )	{        cerr << "Error: X server has no OpenGL GLX extension" << endl;    }    vi = glXChooseVisual( dpy, DefaultScreen(dpy), dblBuf );    if ( vi == NULL )     {       vi = glXChooseVisual( dpy, DefaultScreen(dpy), snglBuf );       if (vi == NULL)       {  		   cerr << "no RGB visual with depth buffer" << endl;       }       doubleBuffer = GL_FALSE;    }    if (vi->c_class != TrueColor)    {	    cerr << "TrueColor visual required for this program" << endl;    }    cmap = XCreateColormap( dpy, 						    RootWindow(dpy, vi->screen), 							vi->visual, 							AllocNone );    swa.colormap = cmap;    swa.border_pixel = 0;    swa.event_mask = ExposureMask | 					 ButtonPressMask | 					 ButtonReleaseMask |					 KeyPressMask |					 Button1MotionMask |					 Button2MotionMask |					 Button3MotionMask | 					 StructureNotifyMask;    // Create Window    	// Create a Window and connect it to the main display dpy	hwin = XCreateWindow( dpy, 						  RootWindow(dpy, vi->screen), 						  0, 0, 300, 300, 						  0, 						  vi->depth,						  InputOutput, 						  vi->visual, 						  CWBorderPixel | CWColormap | CWEventMask, 						  &swa );								XSetStandardProperties(dpy, hwin, "testWindowX", "testWindowX", None, argv, argc, NULL);				win = XWindow::create();	win->addPort( vp );				win->setDisplay ( dpy );	win->setWindow ( hwin );	    win->init();			XMapWindow(dpy, hwin);	XIfEvent(dpy, &event, wait_for_map_notify, (char *)hwin);		win->activate();		// do some OpenGL init. Will move into State Chunks later.		glEnable( GL_DEPTH_TEST );	glEnable( GL_LIGHTING );	glEnable( GL_LIGHT0 );	// main loop ( event dispatching )	Real32 w,h,a,b,c,d;	    while ( !stopIt )     {		do		{		    XNextEvent(dpy, &event);		    switch (event.type) 		    {			    case KeyPress:			 				    cout << "Key pressed: " << event.xkey.keycode << endl;					switch ( event.xkey.keycode ) 					{					    case 16:   						    stopIt = true;							break;					}					break;			    case ButtonPress:				    cout << "Button pressed: " << event.xbutton.button << endl;									switch ( event.xbutton.button ) 					{												case 2:							tball.setAutoPosition(true);							break;						case 3:							tball.setAutoPositionNeg(true);					}					lastx = event.xbutton.x;					lasty = event.xbutton.y;					break;									case ButtonRelease:					cout << "Button released: " << event.xbutton.button << endl;										switch ( event.xbutton.button ) 					{												case 2:							tball.setAutoPosition(false); 							break;						case 3:							tball.setAutoPositionNeg(false);					}					lastx = event.xbutton.x;					lasty = event.xbutton.y;					break;									case MotionNotify:					cout << "MotionNotify" << endl;										w = win->getWidth();					h = win->getHeight();					a = -2. * ( lastx / w - .5 );					b = -2. * ( .5 - lasty / h );					c = -2. * ( event.xmotion.x / w - .5 );					d = -2. * ( .5 - event.xmotion.y / h );										if ( event.xmotion.state & Button1MotionMask )					{						tball.updateRotation( a, b, c, d );					}					if ( event.xmotion.state & Button2MotionMask )					{						tball.updatePosition( a, b, c, d );					}					if ( event.xmotion.state & Button3MotionMask )					{						tball.updatePositionNeg( a, b, c, d );					}					lastx = event.xmotion.x;					lasty = event.xmotion.y;					redraw();					break;								    case ConfigureNotify:			        cout << "ConfigureNotify" << endl;				    if ( ! win->isResizePending() )					{					    win->resize( event.xconfigure.width,								     event.xconfigure.height );					}																					case Expose:					redraw();			 }			 		}     		while ( XPending(dpy) );    }	    return (0);}