Show
Ignore:
Timestamp:
01/10/07 14:52:22 (8 years ago)
Author:
robert
Message:

Ported following examples to osgViewer:

osgparticleeffects
osgphotoalbum
osgpick
osgpoints
osgpointsprite
osgprecipitation
osgprerender
osgprerendercubemap
osgreflect
osgscalarbar
osgscribe
osgsequence
osgplanets

Files:
1 modified

Legend:

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

    r5381 r5954  
    2525#include <osgDB/ReadFile> 
    2626#include <osgUtil/Optimizer> 
    27 #include <osgProducer/Viewer> 
     27#include <osgViewer/Viewer> 
     28 
     29#include <iostream> 
    2830 
    2931// 
     
    320322int main( int argc, char **argv ) 
    321323{ 
    322  
    323324    // use an ArgumentParser object to manage the program arguments. 
    324325    osg::ArgumentParser arguments(&argc,argv); 
    325      
    326     // set up the usage document, in case we need to print out how to use this program. 
    327     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates the use multi-pass rendering, stencil buffer to create a planer reflection effect."); 
    328     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    329     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    330      
    331326 
    332327    // construct the viewer. 
    333     osgProducer::Viewer viewer(arguments); 
    334  
    335     // set up the value with sensible default event handlers. 
    336     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    337  
    338     // get details on keyboard and mouse bindings used by the viewer. 
    339     viewer.getUsage(*arguments.getApplicationUsage()); 
    340  
    341     // if user request help write it out to cout. 
    342     if (arguments.read("-h") || arguments.read("--help")) 
    343     { 
    344         arguments.getApplicationUsage()->write(std::cout); 
    345         return 1; 
    346     } 
    347  
    348     // any option left unread are converted into errors to write out later. 
    349     arguments.reportRemainingOptionsAsUnrecognized(); 
    350  
    351     // report any errors if they have occured when parsing the program aguments. 
    352     if (arguments.errors()) 
    353     { 
    354         arguments.writeErrorMessages(std::cout); 
    355         return 1; 
    356     } 
    357      
    358     if (arguments.argc()<=1) 
    359     { 
    360         arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); 
    361         return 1; 
    362     } 
    363  
     328    osgViewer::Viewer viewer; 
    364329 
    365330    // read the scene from the list of file specified commandline args. 
     
    389354    osg::ref_ptr<osg::Node> rootNode = createMirroredScene(loadedModelTransform.get()); 
    390355 
    391  
    392356    // set the scene to render 
    393357    viewer.setSceneData(rootNode.get()); 
    394358 
    395     // create the windows and run the threads. 
    396     viewer.realize(); 
    397  
    398     while( !viewer.done() ) 
    399     { 
    400         // wait for all cull and draw threads to complete. 
    401         viewer.sync(); 
    402  
    403         // update the scene by traversing it with the the update visitor which will 
    404         // call all node update callbacks and animations. 
    405         viewer.update(); 
    406           
    407         // fire off the cull and draw traversals of the scene. 
    408         viewer.frame(); 
    409          
    410     } 
    411      
    412     // wait for all cull and draw threads to complete. 
    413     viewer.sync(); 
    414  
    415     // run a clean up frame to delete all OpenGL objects. 
    416     viewer.cleanup_frame(); 
    417  
    418     // wait for all the clean up frame to complete. 
    419     viewer.sync(); 
    420      
    421     return 0; 
     359    osg::notify(osg::NOTICE)<<"Warning: NEED TO IMPLEMENT REQUEST OF STENCIL BUFFER!"<<std::endl; 
     360 
     361    return viewer.run(); 
    422362 
    423363}