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

    r5463 r5927  
    1616#include <osgGA/TrackballManipulator> 
    1717 
    18 #include <osgProducer/Viewer> 
     18#include <osgViewer/Viewer> 
    1919 
    2020#include <osgDB/ReadFile> 
     21 
     22#include <iostream> 
    2123 
    2224static bool s_ProfessionalServices = false; 
     
    443445int main( int argc, char **argv ) 
    444446{ 
    445  
    446447    // use an ArgumentParser object to manage the program arguments. 
    447448    osg::ArgumentParser arguments(&argc,argv); 
    448  
    449     // set up the usage document, in case we need to print out how to use this program. 
    450     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates both text, animation and billboard via custom transform to create the OpenSceneGraph logo.."); 
    451     
    452     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+"[options] [filename] ..."); 
    453     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    454     arguments.getApplicationUsage()->addCommandLineOption("ps","Render the Professional Services logo"); 
    455     
    456449    
    457450    osg::DisplaySettings::instance()->setMinimumNumAlphaBits(8); 
    458451    
    459452    // construct the viewer. 
    460     osgProducer::Viewer viewer(arguments); 
    461  
    462     viewer.setWriteImageFileName("logo.rgb"); 
    463      
    464     // set up the value with sensible default event handlers. 
    465     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    466  
    467     // get details on keyboard and mouse bindings used by the viewer. 
    468     viewer.getUsage(*arguments.getApplicationUsage()); 
     453    osgViewer::Viewer viewer; 
    469454 
    470455    // if user request help write it out to cout. 
     
    476461     
    477462    while (arguments.read("ps")) s_ProfessionalServices = true; 
    478  
    479         // any option left unread are converted into errors to write out later. 
    480     arguments.reportRemainingOptionsAsUnrecognized(); 
    481  
    482     // report any errors if they have occured when parsing the program aguments. 
    483     if (arguments.errors()) 
    484     { 
    485         arguments.writeErrorMessages(std::cout); 
    486         return 1; 
    487     } 
    488463     
    489464    osg::Node* node = 0; 
     
    495470    viewer.setSceneData( node ); 
    496471 
    497     // create the windows and run the threads. 
    498     viewer.realize(); 
    499  
    500     while( !viewer.done() ) 
    501     { 
    502         // wait for all cull and draw threads to complete. 
    503         viewer.sync(); 
    504  
    505         // update the scene by traversing it with the the update visitor which will 
    506         // call all node update callbacks and animations. 
    507         viewer.update(); 
    508           
    509         // fire off the cull and draw traversals of the scene. 
    510         viewer.frame(); 
    511          
    512     } 
    513      
    514     // wait for all cull and draw threads to complete. 
    515     viewer.sync(); 
    516  
    517     // run a clean up frame to delete all OpenGL objects. 
    518     viewer.cleanup_frame(); 
    519  
    520     // wait for all the clean up frame to complete. 
    521     viewer.sync(); 
    522  
    523     return 0; 
    524 } 
     472    return viewer.run(); 
     473}