rem: dl->setAmbientColor( .3, .3, .3, 1 ); dl->setDiffuseColor( 1, 1, 1, 1 );
add: dl->setAmbient( .3, .3, .3, 1 ); dl->setDiffuse( 1, 1, 1, 1 );
context: int main (int argc, char **argv){    int i,	    eventThread,        dummy;	// OSG init    osgInit(argc, argv);    basetime = getSystemTime();    gThreadManager = ThreadManager::the();	#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);		// 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 );	// transformation	   	NodePtr t1n = Node::create();    TransformPtr t1 = Transform::create();	beginEditCP(t1n);	t1n->setCore( t1 );	t1n->addChild( b1n );	endEditCP(t1n);	cam_trans = t1;	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();	// Background	BackgroundPtr bkgnd = Background::create();		// Action		ract = DrawAction::create();	// tball	Vec3f pos( 0, 0, max[2] + ( max[2] - min[2] ) * 1.5 );	for ( i = 0; i < NUM_THREADS; i++ )	{		lastx[i] = 0;		lasty[i] = 0;	}		tball.setMode( Trackball::OSGObject );	tball.setStartPosition( pos, true );	tball.setSum( true );	tball.setTranslationMode( Trackball::OSGFree );	// Camera	cam = PerspectiveCamera::create();	cam->setBeacon( cam_trans->getMFParents()->getValue(0) );	cam->setDegrees( 60 );	cam->setNear( 0.1 );	cam->setFar( 10000 );	// 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 Windows        for ( i = 0; i < NUM_THREADS; i++ )    {			// Create a Window and connect it to the main display dpy		hwin[i] = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 300, 300, 0, vi->depth,								InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &swa);		XSetStandardProperties(dpy, hwin[i], "testWindowX", "testWindowX", None, argv, argc, NULL);					win[i] = XWindow::create();		win[i]->setDisplay ( dpy );		win[i]->setWindow ( hwin[i] );	    win[i]->init();				XMapWindow(dpy, hwin[i]);		XIfEvent(dpy, &event, wait_for_map_notify, (char *)hwin[i]);				// Viewport			ViewportPtr vp = Viewport::create();		vp->setCamera( cam );		vp->setBackground( bkgnd );		vp->setRoot( root );		vp->setSize( 0,0, 1,1 );		win[i]->addPort( vp );				}	    for (i = 0; i < NUM_THREADS; i++)    {	    	    		// reset thread stop/resize notify variables		drawThreadStop[i] = false;		// get new thread		drawThread[i] = gThreadManager->getThread(NULL);		if ( drawThread[i] != NULL )   // and spin it ...      	{	   			drawThread[i]->run( drawThreadProc, 0, (void *)i );		}    }	// main loop ( event dispatching )	Real32 w,h,a,b,c,d;	    while ( !stopIt )     {		do		{		    XNextEvent(dpy, &event);		  		  		    for (i=0;i<NUM_THREADS;i++)		    {			    // Thread's window ID equals event's window ID ?		        if ( hwin[i] == event.xany.window )				{				    eventThread = i;					break;				}		    }		   									dpr << "from thread " << eventThread << " ... ";			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[eventThread] = event.xbutton.x;					lasty[eventThread] = 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[eventThread] = event.xbutton.x;					lasty[eventThread] = event.xbutton.y;					break;									case MotionNotify:					cout << "MotionNotify" << endl;										w = win[eventThread]->getWidth();					h = win[eventThread]->getHeight();					a = -2. * ( lastx[eventThread] / w - .5 );					b = -2. * ( .5 - lasty[eventThread] / 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[eventThread] = event.xmotion.x;					lasty[eventThread] = event.xmotion.y;					break;								    case ConfigureNotify:			        cout << "ConfigureNotify" << endl;				    if ( ! win[eventThread]->isResizePending() )					{					    win[eventThread]->resize( event.xconfigure.width,												  event.xconfigure.height );					}				 									default: cout << "unhandled" << endl;			  }		}		while ( XPending(dpy) );    }	     for ( i=0; i<NUM_THREADS; i++ )    {		drawThreadStop[i] = 1;		Thread::join( drawThread[i] );    }    return (0);}