Improved support for toggle between full screen and non fullscreen in

the osgProducer::Viewer.
This commit is contained in:
Robert Osfield
2003-04-04 11:06:09 +00:00
parent e0d7709d50
commit e9e0b4304d
4 changed files with 19 additions and 6 deletions

View File

@@ -63,6 +63,8 @@ class ViewerEventHandler : public osgGA::GUIEventHandler
bool _displayHelp;
FrameStatsMode _frameStatsMode;
bool _firstTimeTogglingFullScreen;
};
}

View File

@@ -76,9 +76,9 @@ std::string extractCameraConfigFile(osg::ArgumentParser& arguments)
if (arguments.read("-c",filename)) return findCameraConfigFile(filename);
char *ptr;
if( (ptr = getenv( "PRODUCE_CAMERA_CONFIG_FILE" )) )
if( (ptr = getenv( "PRODUCER_CAMERA_CONFIG_FILE" )) )
{
osg::notify(osg::DEBUG_INFO) << "PRODUCE_CAMERA_CONFIG_FILE("<<ptr<<")"<<std::endl;
osg::notify(osg::DEBUG_INFO) << "PRODUCER_CAMERA_CONFIG_FILE("<<ptr<<")"<<std::endl;
return findCameraConfigFile(ptr);
}

View File

@@ -188,7 +188,7 @@ void Viewer::realize( ThreadingModel thread_model)
// force a sync before we intialize the keyswitch manipulator to home
// so that Producer has a chance to set up the windows before we do
// any work on them.
OsgCameraGroup::sync();
//OsgCameraGroup::sync();
if (_keyswitchManipulator.valid() && _keyswitchManipulator->getCurrentCameraManipulator())
{

View File

@@ -662,7 +662,7 @@ void DrawCallback::createStatsText()
_drawTimes.push_back(0.0);
pos.x() = cullField->getBound().xMax();
pos.y() -= characterSize;
}
@@ -674,7 +674,8 @@ ViewerEventHandler::ViewerEventHandler(OsgCameraGroup* cg):
_cg(cg),
_writeNodeFileName("saved_model.osg"),
_displayHelp(false),
_frameStatsMode(NO_STATS)
_frameStatsMode(NO_STATS),
_firstTimeTogglingFullScreen(true)
{
Producer::CameraConfig* cfg = _cg->getCameraConfig();
Producer::Camera *cam = cfg->getCamera(0);
@@ -716,8 +717,18 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
{
Producer::Camera *cam = cfg->getCamera(i);
Producer::RenderSurface* rs = cam->getRenderSurface();
rs->fullScreen(!rs->isFullScreen());
if (_firstTimeTogglingFullScreen && rs->isFullScreen())
{
rs->setWindowRect(240,220,800,600);
rs->useBorder(true);
}
else
{
rs->fullScreen(!rs->isFullScreen());
}
}
_firstTimeTogglingFullScreen = false;
return true;
}