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/osgscalarbar/osgscalarbar.cpp

    r5928 r5954  
    1111#include <osgUtil/CullVisitor> 
    1212 
    13  
    1413#include <osgGA/TrackballManipulator> 
    15 #include <osgProducer/Viewer> 
     14#include <osgViewer/Viewer> 
    1615#include <osgDB/ReadFile> 
    1716 
     
    2120 
    2221#include <sstream> 
     22#include <iostream> 
    2323#include <math.h> 
    2424 
     
    114114} 
    115115 
    116 int main( int argc, char **argv ) 
     116int main(int , char **) 
    117117{ 
    118     // use an ArgumentParser object to manage the program arguments. 
    119     osg::ArgumentParser arguments(&argc,argv); 
    120  
    121     // set up the usage document, in case we need to print out how to use this program. 
    122     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates both text, animation and billboard via custom transform to create the OpenSceneGraph logo.."); 
    123     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    124     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    125     arguments.getApplicationUsage()->addCommandLineOption("ps","Render the Professional Services logo"); 
    126  
    127118    // construct the viewer. 
    128     osgProducer::Viewer viewer(arguments); 
    129  
    130     // set up the value with sensible default event handlers. 
    131     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    132  
    133     // get details on keyboard and mouse bindings used by the viewer. 
    134     viewer.getUsage(*arguments.getApplicationUsage()); 
    135  
    136     // if user request help write it out to cout. 
    137     if (arguments.read("-h") || arguments.read("--help")) 
    138     { 
    139         arguments.getApplicationUsage()->write(std::cout); 
    140         return 1; 
    141     } 
    142  
    143     // any option left unread are converted into errors to write out later. 
    144     arguments.reportRemainingOptionsAsUnrecognized(); 
    145  
    146     // report any errors if they have occured when parsing the program aguments. 
    147     if (arguments.errors()) 
    148     { 
    149         arguments.writeErrorMessages(std::cout); 
    150         return 1; 
    151     } 
     119    osgViewer::Viewer viewer; 
    152120 
    153121    osg::Group* group = new osg::Group; 
     
    158126    viewer.setSceneData( group ); 
    159127 
    160     // create the windows and run the threads. 
    161     viewer.realize(); 
    162  
    163     while( !viewer.done() ) 
    164     { 
    165         
    166         // wait for all cull and draw threads to complete. 
    167         viewer.sync(); 
    168  
    169         // update the scene by traversing it with the the update visitor which will 
    170         // call all node update callbacks and animations. 
    171         viewer.update(); 
    172  
    173         // fire off the cull and draw traversals of the scene. 
    174         viewer.frame(); 
    175     } 
    176  
    177     // wait for all cull and draw threads to complete. 
    178     viewer.sync(); 
    179  
    180     // run a clean up frame to delete all OpenGL objects. 
    181     viewer.cleanup_frame(); 
    182  
    183     // wait for all the clean up frame to complete. 
    184     viewer.sync(); 
    185  
    186     return 0; 
     128    return viewer.run(); 
    187129}