source: experimental/distortionNG/extViewer.cpp @ 312

Last change on this file since 312 was 311, checked in by Torben Dannhauer, 13 years ago
File size: 1.6 KB
RevLine 
[310]1#include "extViewer.h"
2
[311]3extViewer::extViewer() : Viewer()
[310]4{
[311]5
[310]6}
7
[311]8extViewer::extViewer(osg::ArgumentParser& arguments) : Viewer(arguments)
[310]9{
[311]10
[310]11}
[311]12
13extViewer::extViewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop) : Viewer(viewer, copyop)
14{
15
16}
17
18extViewer::~extViewer()
19{
20
21}
22
23void 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}
Note: See TracBrowser for help on using the repository browser.