add: QGLFormat::setDefaultFormat(QGLFormat(QGL::DirectRendering | QGL::DoubleBuffer    | QGL::DepthBuffer     | QGL::Rgba            ));
context: int main( int argc, char **argv ){    Int32 i,          retVal;    // OSG init    osgInit(argc, argv);    basetime = getSystemTime();    gThreadManager = ThreadManager::the();      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->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 = NullFC;        if ( argc > 1 )        file = SceneFileHandler::the().read(argv[1]);        if ( file == NullFC )    {        cerr << "Couldn't load file, ignoring" << endl;        file = makePlane( 2,2,2,2 );    }        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->setFov( deg2rad( 60 ) );    cam->setNear( 0.1 );    cam->setFar( 10000 );    // Background    GradientBackgroundPtr bkgnd = GradientBackground::create();    bkgnd->addColor( Color3f( 0,0,0 ), 0 );    bkgnd->addColor( Color3f( 0,0,1 ), 0 );        // Action        // QT init    QApplication::setColorSpec( QApplication::CustomColor );    a = new QApplication( argc, argv );    if ( !QGLFormat::hasOpenGL() )    {        qWarning( "This system has no OpenGL support. Exiting." );        return -1;    }    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 );    // Create Windows        for ( i = 0; i < NUM_THREADS; i++ )    {           glWidget[i] = new MyOSGQGLWidget();        // Viewport        vp = Viewport::create();        vp->setCamera( cam );        vp->setBackground( bkgnd );        vp->setRoot( root );        vp->setSize( 0,0, 1,1 );        glWidget[i]->_osgWin = QTWindow::create();        glWidget[i]->_osgWin->setGlWidget( glWidget[i] );        glWidget[i]->_osgWin->addPort( vp );        glWidget[i]->_osgWin->init();                if ( i == 0 )        {                     a->setMainWidget( glWidget[0] );        }        glWidget[i]->show();    }        for (i = 0; i < NUM_THREADS; i++)    {             drawThread[i] =             dynamic_cast<Thread *>(gThreadManager->getThread(NULL));        if ( drawThread[i] != NULL )        {                  drawThreadID[i] = i;            drawThread[i]->runFunction( drawThreadProc, 0, (void *) &(drawThreadID[i]) );        }    }    drawBarrier = gThreadManager->getBarrier( "drawBarrier" );//    glWidget[0]->paintGL();        retVal = a->exec();    // execute QT main loop        // stop th ethreads    for ( i=0; i<NUM_THREADS; i++ )        glWidget[i]->_stop = true;    drawBarrier->enter( NUM_THREADS + 1 );    for ( i=0; i<NUM_THREADS; i++ )        Thread::join( drawThread[i] );    return (retVal);}