Added DisplaySettings support into osgViewer::Viewer
This commit is contained in:
@@ -376,6 +376,7 @@ int main(int argc, char** argv)
|
||||
|
||||
}
|
||||
|
||||
osg::DisplaySettings::instance()->setMinimumNumStencilBits(8);
|
||||
|
||||
viewer.setSceneData(group.get());
|
||||
|
||||
|
||||
@@ -475,8 +475,6 @@ int main( int argc, char **argv )
|
||||
|
||||
//osgDB::writeNodeFile(*rootNode,"test.osg");
|
||||
|
||||
// set the scene to render
|
||||
viewer.setSceneData(rootNode.get());
|
||||
|
||||
viewer.getCamera()->setCullMask(0xffffffff);
|
||||
viewer.getCamera()->setCullMaskLeft(0x00000001);
|
||||
@@ -485,6 +483,9 @@ int main( int argc, char **argv )
|
||||
// set up the use of stereo by default.
|
||||
osg::DisplaySettings::instance()->setStereo(true);
|
||||
|
||||
// set the scene to render
|
||||
viewer.setSceneData(rootNode.get());
|
||||
|
||||
// create the windows and run the threads.
|
||||
viewer.realize();
|
||||
|
||||
|
||||
@@ -50,6 +50,17 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
EventHandlers& getEventHandlers() { return _eventHandlers; }
|
||||
const EventHandlers& getEventHandlers() const { return _eventHandlers; }
|
||||
|
||||
|
||||
/** Set the DsplaySettings object associated with this view.*/
|
||||
void setDisplaySettings(osg::DisplaySettings* ds) { _displaySettings = ds; }
|
||||
|
||||
/** Set the DsplaySettings object associated with this view.*/
|
||||
osg::DisplaySettings* getDisplaySettings() { return _displaySettings.get(); }
|
||||
|
||||
/** Set the DsplaySettings object associated with this view.*/
|
||||
const osg::DisplaySettings* getDisplaySettings() const { return _displaySettings.get(); }
|
||||
|
||||
|
||||
/** Convinience method for creating slave Cameras and associated GraphicsWindows across all screens.*/
|
||||
void setUpViewAcrossAllScreens();
|
||||
|
||||
@@ -87,6 +98,8 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter
|
||||
|
||||
typedef std::map<osg::ref_ptr<osg::Camera>, osg::ref_ptr<osgUtil::SceneView> > CameraSceneViewMap;
|
||||
CameraSceneViewMap _cameraSceneViewMap;
|
||||
|
||||
osg::ref_ptr<osg::DisplaySettings> _displaySettings;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ void View::setUpViewAcrossAllScreens()
|
||||
return;
|
||||
}
|
||||
|
||||
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance();
|
||||
|
||||
double fovy, aspectRatio, zNear, zFar;
|
||||
_camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
|
||||
|
||||
@@ -87,6 +89,8 @@ void View::setUpViewAcrossAllScreens()
|
||||
traits->y = 0;
|
||||
traits->width = width;
|
||||
traits->height = height;
|
||||
traits->alpha = ds->getMinimumNumAlphaBits();
|
||||
traits->stencil = ds->getMinimumNumStencilBits();
|
||||
traits->windowDecoration = false;
|
||||
traits->doubleBuffer = true;
|
||||
traits->sharedContext = 0;
|
||||
@@ -134,6 +138,8 @@ void View::setUpViewAcrossAllScreens()
|
||||
traits->y = 0;
|
||||
traits->width = width;
|
||||
traits->height = height;
|
||||
traits->alpha = ds->getMinimumNumAlphaBits();
|
||||
traits->stencil = ds->getMinimumNumStencilBits();
|
||||
traits->windowDecoration = false;
|
||||
traits->doubleBuffer = true;
|
||||
traits->sharedContext = 0;
|
||||
@@ -180,6 +186,8 @@ void View::setUpViewAcrossAllScreens()
|
||||
traits->y = 0;
|
||||
traits->width = width;
|
||||
traits->height = height;
|
||||
traits->alpha = ds->getMinimumNumAlphaBits();
|
||||
traits->stencil = ds->getMinimumNumStencilBits();
|
||||
traits->windowDecoration = false;
|
||||
traits->doubleBuffer = true;
|
||||
traits->sharedContext = 0;
|
||||
@@ -225,6 +233,8 @@ void View::setUpViewOnSingleScreen(unsigned int screenNum)
|
||||
return;
|
||||
}
|
||||
|
||||
osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance();
|
||||
|
||||
unsigned int width, height;
|
||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(screenNum), width, height);
|
||||
|
||||
@@ -233,6 +243,8 @@ void View::setUpViewOnSingleScreen(unsigned int screenNum)
|
||||
traits->y = 0;
|
||||
traits->width = width;
|
||||
traits->height = height;
|
||||
traits->alpha = ds->getMinimumNumAlphaBits();
|
||||
traits->stencil = ds->getMinimumNumStencilBits();
|
||||
traits->windowDecoration = false;
|
||||
traits->doubleBuffer = true;
|
||||
traits->sharedContext = 0;
|
||||
|
||||
@@ -453,6 +453,7 @@ void Viewer::setUpRenderingSupport()
|
||||
_cameraSceneViewMap[_camera] = sceneView;
|
||||
|
||||
sceneView->setDefaults();
|
||||
sceneView->setDisplaySettings(_displaySettings.get());
|
||||
sceneView->setCamera(_camera.get());
|
||||
sceneView->setState(_camera->getGraphicsContext()->getState());
|
||||
sceneView->setSceneData(getSceneData());
|
||||
@@ -471,6 +472,7 @@ void Viewer::setUpRenderingSupport()
|
||||
|
||||
sceneView->setDefaults();
|
||||
sceneView->setCamera(slave._camera.get());
|
||||
sceneView->setDisplaySettings(_displaySettings.get());
|
||||
sceneView->setState(slave._camera->getGraphicsContext()->getState());
|
||||
sceneView->setSceneData(getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
Reference in New Issue
Block a user