Show
Ignore:
Timestamp:
12/17/06 21:49:01 (7 years ago)
Author:
robert
Message:

Added support WindowingSystemInterface? for querring the number of screens, the screen size and creating GraphicsContexts?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgcamera/osgcamera.cpp

    r5757 r5822  
    149149    } 
    150150 
    151     unsigned int numberCameras = 3; 
     151    osg::GraphicsContext::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); 
     152    if (!wsi)  
     153    { 
     154        std::cout<<"No WindowSystemInterface available, cannot create windows."<<std::endl; 
     155        return 1; 
     156    } 
     157 
     158    unsigned int numScreens = wsi->getNumScreens(); 
     159    for(unsigned int i=0; i<numScreens; ++i) 
     160    { 
     161        osg::GraphicsContext::ScreenIdentifier si; 
     162        si._screenNum = 0; 
     163         
     164        unsigned int width, height; 
     165        wsi->getScreenResolution(si, width, height); 
     166         
     167        std::cout<<"screen= "<<i<<" width="<<width<<" height="<<height<<std::endl; 
     168    } 
     169         
     170 
     171    unsigned int numberCameras = numScreens; 
    152172    while (arguments.read("--cameras",numberCameras)) {} 
    153173 
     
    187207    CameraList cameraList; 
    188208    GraphicsContextSet graphicsContextSet; 
     209     
     210     
    189211 
    190212    // create the cameras, graphic contexts and graphic threads. 
     
    198220        osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; 
    199221        traits->_windowName = "osgcamera"; 
     222        traits->_screenNum = i % numScreens; 
    200223        traits->_x = xpos; 
    201224        traits->_y = ypos;