Show
Ignore:
Timestamp:
01/10/07 14:52:22 (7 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/osgscribe/osgscribe.cpp

    r5381 r5954  
    1010#include <osgDB/ReadFile> 
    1111 
    12 #include <osgProducer/Viewer> 
     12#include <osgViewer/Viewer> 
    1313 
    1414#include <osgUtil/Optimizer> 
     
    1616int main( int argc, char **argv ) 
    1717{ 
    18  
    1918    // use an ArgumentParser object to manage the program arguments. 
    2019    osg::ArgumentParser arguments(&argc,argv); 
    2120 
    22     // set up the usage document, in case we need to print out how to use this program. 
    23     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to use multi-pass and state inheritance to create a scribed rendered effect."); 
    24     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    25     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    26     
    2721    // construct the viewer. 
    28     osgProducer::Viewer viewer(arguments); 
    29  
    30     // set up the value with sensible default event handlers. 
    31     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    32  
    33     // get details on keyboard and mouse bindings used by the viewer. 
    34     viewer.getUsage(*arguments.getApplicationUsage()); 
    35  
    36     // if user request help write it out to cout. 
    37     if (arguments.read("-h") || arguments.read("--help")) 
    38     { 
    39         arguments.getApplicationUsage()->write(std::cout); 
    40         return 1; 
    41     } 
    42  
    43     // any option left unread are converted into errors to write out later. 
    44     arguments.reportRemainingOptionsAsUnrecognized(); 
    45  
    46     // report any errors if they have occured when parsing the program aguments. 
    47     if (arguments.errors()) 
    48     { 
    49         arguments.writeErrorMessages(std::cout); 
    50         return 1; 
    51     } 
    52      
    53     if (arguments.argc()<=1) 
    54     { 
    55         arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); 
    56         return 1; 
    57     } 
     22    osgViewer::Viewer viewer; 
    5823 
    5924    // load the nodes from the commandline arguments. 
     
    6126    if (!loadedModel) 
    6227    { 
     28        osg::notify(osg::NOTICE)<<"Please specifiy a model filename on the command line."<<std::endl; 
    6329        return 1; 
    6430    } 
     
    12894    viewer.setSceneData( rootnode ); 
    12995     
    130     // create the windows and run the threads. 
    131     viewer.realize(); 
    132  
    133     while( !viewer.done() ) 
    134     { 
    135         // wait for all cull and draw threads to complete. 
    136         viewer.sync(); 
    137  
    138         // update the scene by traversing it with the the update visitor which will 
    139         // call all node update callbacks and animations. 
    140         viewer.update(); 
    141           
    142         // fire off the cull and draw traversals of the scene. 
    143         viewer.frame(); 
    144          
    145     } 
    146      
    147     // wait for all cull and draw threads to complete. 
    148     viewer.sync(); 
    149  
    150     // run a clean up frame to delete all OpenGL objects. 
    151     viewer.cleanup_frame(); 
    152  
    153     // wait for all the clean up frame to complete. 
    154     viewer.sync(); 
    155  
    156     return 0; 
     96    return viewer.run(); 
    15797}