Show
Ignore:
Timestamp:
01/08/07 11:00:16 (7 years ago)
Author:
robert
Message:

Ported following examples to osgViewer:

osggeodemo
osggeometry
osghud
osgimpostor
osgkeyboard
osglauncher
osglight
osglightpoint
osglogicop
osglogo
osgmovie
osgmultiplecameras
osgmultitexture
osgoccluder
osgparametric
osgparticle

Files:
1 modified

Legend:

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

    r5381 r5927  
    1 #include <osgProducer/Viewer> 
     1#include <osgViewer/Viewer> 
    22 
    33#include <osg/Notify> 
     
    1616#include <osgUtil/Optimizer> 
    1717 
     18#include <iostream> 
    1819 
    1920int main( int argc, char **argv ) 
     
    2122    // use an ArgumentParser object to manage the program arguments. 
    2223    osg::ArgumentParser arguments(&argc,argv); 
    23  
    24     // set up the usage document, in case we need to print out how to use this program. 
    25     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates a simple use of multi-texturing."); 
    26     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    27     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    2824    
    2925    // construct the viewer. 
    30     osgProducer::Viewer viewer(arguments); 
    31  
    32     // set up the value with sensible default event handlers. 
    33     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    34  
    35     // get details on keyboard and mouse bindings used by the viewer. 
    36     viewer.getUsage(*arguments.getApplicationUsage()); 
    37  
    38     // if user request help write it out to cout. 
    39     if (arguments.read("-h") || arguments.read("--help")) 
    40     { 
    41         arguments.getApplicationUsage()->write(std::cout); 
    42         return 1; 
    43     } 
    44  
    45     // any option left unread are converted into errors to write out later. 
    46     arguments.reportRemainingOptionsAsUnrecognized(); 
    47  
    48     // report any errors if they have occured when parsing the program aguments. 
    49     if (arguments.errors()) 
    50     { 
    51         arguments.writeErrorMessages(std::cout); 
    52         return 1; 
    53     } 
    54      
    55     if (arguments.argc()<=1) 
    56     { 
    57         arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); 
    58         return 1; 
    59     } 
     26    osgViewer::Viewer viewer; 
    6027 
    6128    // load the nodes from the commandline arguments. 
     
    6330    if (!rootnode) 
    6431    { 
    65 //        write_usage(osg::notify(osg::NOTICE),argv[0]); 
     32        osg::notify(osg::NOTICE)<<"Please specify and model filename on the command line."<<std::endl; 
    6633        return 1; 
    6734    } 
     
    10370 
    10471    for(unsigned int contextID = 0;  
    105         contextID<viewer.getDisplaySettings()->getMaxNumberOfGraphicsContexts(); 
     72        contextID<osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(); 
    10673        ++contextID) 
    10774    { 
     
    11784    } 
    11885 
    119     while( !viewer.done() ) 
    120     { 
    121         // wait for all cull and draw threads to complete. 
    122         viewer.sync(); 
    123  
    124         // update the scene by traversing it with the the update visitor which will 
    125         // call all node update callbacks and animations. 
    126         viewer.update(); 
    127           
    128         // fire off the cull and draw traversals of the scene. 
    129         viewer.frame(); 
    130          
    131     } 
    132      
    133     // wait for all cull and draw threads to complete. 
    134     viewer.sync(); 
    135  
    136     // run a clean up frame to delete all OpenGL objects. 
    137     viewer.cleanup_frame(); 
    138  
    139     // wait for all the clean up frame to complete. 
    140     viewer.sync(); 
    141  
    142     return 0; 
     86    return viewer.run(); 
    14387}