[310] | 1 | #include "extViewer.h" |
---|
| 2 | |
---|
[311] | 3 | extViewer::extViewer() : Viewer() |
---|
[310] | 4 | { |
---|
[311] | 5 | |
---|
[310] | 6 | } |
---|
| 7 | |
---|
[311] | 8 | extViewer::extViewer(osg::ArgumentParser& arguments) : Viewer(arguments) |
---|
[310] | 9 | { |
---|
[311] | 10 | |
---|
[310] | 11 | } |
---|
[311] | 12 | |
---|
| 13 | extViewer::extViewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop) : Viewer(viewer, copyop) |
---|
| 14 | { |
---|
| 15 | |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | extViewer::~extViewer() |
---|
| 19 | { |
---|
| 20 | |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | void extViewer::setUpViewForDistortion() |
---|
| 24 | { |
---|
| 25 | OSG_INFO<<"View::setUpViewForDistortion"<<std::endl; |
---|
| 26 | osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); |
---|
| 27 | if (!wsi) |
---|
| 28 | { |
---|
| 29 | OSG_NOTICE<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl; |
---|
| 30 | return; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | osg::GraphicsContext::ScreenIdentifier si; |
---|
| 34 | si.readDISPLAY(); |
---|
| 35 | |
---|
| 36 | // displayNum has not been set so reset it to 0. |
---|
| 37 | if (si.displayNum<0) si.displayNum = 0; |
---|
| 38 | |
---|
| 39 | si.screenNum = screenNum; |
---|
| 40 | |
---|
| 41 | unsigned int width, height; |
---|
| 42 | wsi->getScreenResolution(si, width, height); |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; |
---|
| 46 | traits->hostName = si.hostName; |
---|
| 47 | traits->displayNum = si.displayNum; |
---|
| 48 | traits->screenNum = si.screenNum; |
---|
| 49 | traits->x = 0; |
---|
| 50 | traits->y = 0; |
---|
| 51 | traits->width = width; |
---|
| 52 | traits->height = height; |
---|
| 53 | traits->windowDecoration = false; |
---|
| 54 | traits->doubleBuffer = true; |
---|
| 55 | traits->sharedContext = 0; |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); |
---|
| 59 | if (!gc) |
---|
| 60 | { |
---|
| 61 | OSG_NOTICE<<"GraphicsWindow has not been created successfully."<<std::endl; |
---|
| 62 | return; |
---|
| 63 | } |
---|
| 64 | } |
---|