Show
Ignore:
Timestamp:
01/06/07 22:35:57 (8 years ago)
Author:
robert
Message:

Ported osgcopy, osgcubemap, osgdelaunay, osgdepthpartion, osgdistortion, osgfadetext, osgforest and osgfxbrowser to osgViewer

Files:
1 modified

Legend:

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

    r5381 r5923  
    1717#include <osgGA/DriveManipulator> 
    1818 
    19 #include <osgProducer/Viewer> 
     19#include <osgViewer/Viewer> 
    2020 
    2121#include <iostream> 
     
    7474    osg::ArgumentParser arguments(&argc,argv); 
    7575 
    76     // set up the usage document, in case we need to print out how to use this program. 
    77     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use texture cube mapping."); 
    78     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    79     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    80     
    8176    // construct the viewer. 
    82     osgProducer::Viewer viewer(arguments); 
    83  
    84     // set up the value with sensible default event handlers. 
    85     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    86  
    87     // get details on keyboard and mouse bindings used by the viewer. 
    88     viewer.getUsage(*arguments.getApplicationUsage()); 
    89  
    90     // if user request help write it out to cout. 
    91     if (arguments.read("-h") || arguments.read("--help")) 
    92     { 
    93         arguments.getApplicationUsage()->write(std::cout); 
    94         return 1; 
    95     } 
    96  
    97     // any option left unread are converted into errors to write out later. 
    98     arguments.reportRemainingOptionsAsUnrecognized(); 
    99  
    100     // report any errors if they have occured when parsing the program aguments. 
    101     if (arguments.errors()) 
    102     { 
    103         arguments.writeErrorMessages(std::cout); 
    104         return 1; 
    105     } 
     77    osgViewer::Viewer viewer; 
    10678     
    107     if (arguments.argc()<=1) 
    108     { 
    109         arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); 
    110         return 1; 
    111     } 
    112  
    11379    // load the nodes from the commandline arguments. 
    11480    osg::Node* rootnode = osgDB::readNodeFiles(arguments); 
    11581    if (!rootnode) { 
     82        osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl; 
    11683        return 1; 
    11784    } 
     
    13097    viewer.realize(); 
    13198 
    132  
    13399    // now check to see if texture cube map is supported. 
    134100    for(unsigned int contextID = 0;  
    135         contextID<viewer.getDisplaySettings()->getMaxNumberOfGraphicsContexts(); 
     101        contextID<osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(); 
    136102        ++contextID) 
    137103    { 
     
    147113    } 
    148114 
    149     while( !viewer.done() ) 
    150     { 
    151         // wait for all cull and draw threads to complete. 
    152         viewer.sync(); 
    153  
    154         // update the scene by traversing it with the the update visitor which will 
    155         // call all node update callbacks and animations. 
    156         viewer.update(); 
    157           
    158         // fire off the cull and draw traversals of the scene. 
    159         viewer.frame(); 
    160          
    161     } 
    162      
    163     // wait for all cull and draw threads to complete. 
    164     viewer.sync(); 
    165  
    166     // run a clean up frame to delete all OpenGL objects. 
    167     viewer.cleanup_frame(); 
    168  
    169     // wait for all the clean up frame to complete. 
    170     viewer.sync(); 
    171  
    172     return 0; 
     115    return viewer.run(); 
    173116}