Added control of threading model, setting default to SingleThreaded to avoid crash

associated with mixing useCursor(false) and multi-threading.
This commit is contained in:
Robert Osfield 2007-06-04 17:11:40 +00:00
parent 5138ff300b
commit e25f04c4db

View File

@ -399,6 +399,10 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images."); arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images.");
arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images."); arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images.");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullDrawThreadPerContext","Select CullDrawThreadPerContext threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--DrawThreadPerContext","Select DrawThreadPerContext threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullThreadPerCameraDrawThreadPerContext","Select CullThreadPerCameraDrawThreadPerContext threading model for viewer.");
// construct the viewer. // construct the viewer.
@ -428,6 +432,14 @@ int main( int argc, char **argv )
return 1; return 1;
} }
osgViewer::Viewer::ThreadingModel threading = osgViewer::Viewer::SingleThreaded;
while (arguments.read("--SingleThreaded")) threading = osgViewer::Viewer::SingleThreaded;
while (arguments.read("--CullDrawThreadPerContext")) threading = osgViewer::Viewer::CullDrawThreadPerContext;
while (arguments.read("--DrawThreadPerContext")) threading = osgViewer::Viewer::DrawThreadPerContext;
while (arguments.read("--CullThreadPerCameraDrawThreadPerContext")) threading = osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext;
viewer.setThreadingModel(threading);
// any option left unread are converted into errors to write out later. // any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized(); arguments.reportRemainingOptionsAsUnrecognized();
@ -486,6 +498,7 @@ int main( int argc, char **argv )
// set the scene to render // set the scene to render
viewer.setSceneData(rootNode.get()); viewer.setSceneData(rootNode.get());
// create the windows and run the threads. // create the windows and run the threads.
viewer.realize(); viewer.realize();