Show
Ignore:
Timestamp:
01/23/07 16:51:43 (8 years ago)
Author:
robert
Message:

Added single screen option

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgshadow/osgshadow.cpp

    r6035 r6036  
    1414#include <osgGA/DriveManipulator> 
    1515#include <osgGA/KeySwitchMatrixManipulator> 
    16 #include <osgGA/StateSetManipulator> 
    1716#include <osgGA/AnimationPathManipulator> 
    1817#include <osgGA/TerrainManipulator> 
    1918#include <osgGA/AnimationPathManipulator> 
     19#include <osgGA/StateSetManipulator> 
    2020 
    2121#include <osgViewer/Viewer> 
     
    150150    arguments.getApplicationUsage()->addCommandLineOption("--two-pass", "Use two-pass stencil for shadow volumes."); 
    151151 
     152    // hint to tell viewer to request stencil buffer when setting up windows 
     153    osg::DisplaySettings::instance()->setMinimumNumStencilBits(8); 
     154 
    152155    // construct the viewer. 
    153156    osgViewer::Viewer viewer; 
     
    176179    while (arguments.read("--noShadow")) doShadow = false; 
    177180     
     181    int screenNum = -1; 
     182    while (arguments.read("--screen", screenNum)) viewer.setUpViewOnSingleScreen(screenNum); 
     183 
    178184    osgShadow::ShadowVolumeGeometry::DrawMode drawMode = osgShadow::ShadowVolumeGeometry::STENCIL_TWO_SIDED; 
    179185    while (arguments.read("--two-sided")) drawMode = osgShadow::ShadowVolumeGeometry::STENCIL_TWO_SIDED; 
     
    206212        viewer.setCameraManipulator( keyswitchManipulator.get() ); 
    207213    } 
     214 
     215 
     216    // add the state manipulator 
     217    viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) ); 
    208218 
    209219    // add stats 
     
    438448            } 
    439449                     
    440         }     
    441  
    442     } 
    443  
    444     // hint to tell viewer to request stencil buffer when setting up windows 
    445     osg::DisplaySettings::instance()->setMinimumNumStencilBits(8); 
     450        } 
     451 
     452    } 
     453 
    446454 
    447455    viewer.setSceneData(group.get()); 
    448  
     456     
    449457    // create the windows and run the threads. 
    450458    viewer.realize();