Show
Ignore:
Timestamp:
01/11/07 16:19:59 (8 years ago)
Author:
robert
Message:

Ported following examples to osgViewer:

osgteapot
osgtessellate
osgtext
osgtexture1D
osgtexture2D
osgtexture3D
osgtexturerectangle
osgvertexprogram
osgvolume
osgwindows
osgsimple
osgkeyboardmouse

Files:
1 modified

Legend:

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

    r5523 r5962  
    3030#include <osgDB/ReadFile> 
    3131 
    32 #include <osgProducer/Viewer> 
     32#include <osgViewer/Viewer> 
    3333 
    3434 
     
    239239    osg::ArgumentParser arguments(&argc,argv); 
    240240 
    241     // set up the usage document, in case we need to print out how to use this program. 
    242     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a demo which demonstrates use of osg::TextureRectangle."); 
    243     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] <image> ..."); 
    244     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    245     
    246241    // construct the viewer. 
    247     osgProducer::Viewer viewer(arguments); 
    248  
    249     // set up the value with sensible default event handlers. 
    250     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    251  
    252     // get details on keyboard and mouse bindings used by the viewer. 
    253     viewer.getUsage(*arguments.getApplicationUsage()); 
    254  
    255     // if user request help write it out to cout. 
    256     if (arguments.read("-h") || arguments.read("--help")) 
    257     { 
    258         arguments.getApplicationUsage()->write(std::cout); 
    259         return 1; 
    260     } 
    261  
    262     // any option left unread are converted into errors to write out later. 
    263     arguments.reportRemainingOptionsAsUnrecognized(); 
    264  
    265     // report any errors if they have occured when parsing the program aguments. 
    266     if (arguments.errors()) 
    267     { 
    268         arguments.writeErrorMessages(std::cout); 
    269         return 1; 
    270     } 
     242    osgViewer::Viewer viewer; 
    271243 
    272244    // create a model from the images. 
     
    275247    // add model to viewer. 
    276248    viewer.setSceneData(rootNode); 
    277  
    278     // create the windows and run the threads. 
    279     viewer.realize(); 
    280  
    281     while (!viewer.done()) 
    282     { 
    283         // wait for all cull and draw threads to complete. 
    284         viewer.sync(); 
    285  
    286         // update the scene by traversing it with the the update visitor which will 
    287         // call all node update callbacks and animations. 
    288         viewer.update(); 
    289  
    290         // fire off the cull and draw traversals of the scene. 
    291         viewer.frame(); 
    292     } 
    293  
    294     // wait for all cull and draw threads to complete. 
    295     viewer.sync(); 
    296  
    297     // run a clean up frame to delete all OpenGL objects. 
    298     viewer.cleanup_frame(); 
    299  
    300     // wait for all the clean up frame to complete. 
    301     viewer.sync(); 
    302      
    303     return 0; 
    304 } 
     249     
     250    return viewer.run(); 
     251}