Ignore:
Timestamp:
Aug 3, 2011, 10:10:59 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r310 r311  
    11#include "extViewer.h"
    22
    3 extViewer::extViewer(void)
     3extViewer::extViewer() : Viewer()
    44{
     5
    56}
    67
    7 extViewer::~extViewer(void)
     8extViewer::extViewer(osg::ArgumentParser& arguments) : Viewer(arguments)
    89{
     10
    911}
     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}
  • experimental/distortionNG/extViewer.h

    r310 r311  
    33
    44class extViewer : public osgViewer::Viewer
    5 
    65{
    76public:
    8         extViewer(void);
    9         virtual ~extViewer(void);
     7        extViewer();
     8
     9        extViewer(osg::ArgumentParser& arguments);
     10
     11        extViewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
     12
     13        virtual ~extViewer();
     14
     15                /** Convenience method for projection on curved screens using a slave camera rendering scene and a second camera doing distortion correction to present on a nonplaner display.*/
     16        void setUpViewForDistortion();
    1017};
  • experimental/distortionNG/main.cpp

    r310 r311  
    4040
    4141    // construct the viewer.
    42     osgViewer::Viewer viewer(arguments);
     42    extViewer viewer(arguments);
    4343
    4444    // set up the camera manipulators.
Note: See TracChangeset for help on using the changeset viewer.