- Timestamp:
- 01/10/07 22:05:26 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgshaderterrain/osgshaderterrain.cpp
r5863 r5956 27 27 #include <osgText/Text> 28 28 29 #include <osgProducer/Viewer> 29 #include <osgViewer/Viewer> 30 31 #include <iostream> 30 32 31 33 // for the grid data.. … … 123 125 stateset->setAttribute(program); 124 126 125 #if 0127 #if 1 126 128 // use inline shaders 127 129 … … 142 144 " texcoord.y *= terrainScaleDown.y;\n" 143 145 "\n" 144 " vec4 position;\n" ttm->146 " vec4 position;\n" 145 147 " position.x = gl_Vertex.x;\n" 146 148 " position.y = gl_Vertex.y;\n" … … 240 242 } 241 243 244 #if 0 242 245 class TestSupportCallback : public osgProducer::OsgCameraGroup::RealizeCallback 243 246 { … … 278 281 279 282 }; 280 281 int main( int argc, char **argv ) 283 #endif 284 285 int main(int, char **) 282 286 { 283 284 // use an ArgumentParser object to manage the program arguments.285 osg::ArgumentParser arguments(&argc,argv);286 287 // set up the usage document, in case we need to print out how to use this program.288 arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates the osg::Shape classes.");289 arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");290 arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");291 arguments.getApplicationUsage()->addCommandLineOption("--trees <number>","Set the number of trees to create");292 293 287 // construct the viewer. 294 osgProducer::Viewer viewer(arguments); 295 296 // set up the value with sensible default event handlers. 297 viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 298 299 // get details on keyboard and mouse bindings used by the viewer. 300 viewer.getUsage(*arguments.getApplicationUsage()); 301 302 // if user request help write it out to cout. 303 if (arguments.read("-h") || arguments.read("--help")) 304 { 305 arguments.getApplicationUsage()->write(std::cout); 306 return 1; 307 } 308 309 // any option left unread are converted into errors to write out later. 310 arguments.reportRemainingOptionsAsUnrecognized(); 311 312 // report any errors if they have occured when parsing the program aguments. 313 if (arguments.errors()) 314 { 315 arguments.writeErrorMessages(std::cout); 316 return 1; 317 } 318 288 osgViewer::Viewer viewer; 289 319 290 osg::Node* node = createScene(); 320 291 … … 322 293 viewer.setSceneData( node ); 323 294 295 #if 0 324 296 // register a test extension callback to be called when app realizes and gets a valid graphics context 325 297 osg::ref_ptr<TestSupportCallback> testSupportCallback = new TestSupportCallback(); 326 298 viewer.setRealizeCallback(testSupportCallback.get()); 327 328 299 // create the windows and run the threads. 329 300 viewer.realize(); … … 336 307 exit(1); 337 308 } 338 339 while( !viewer.done() ) 340 { 341 // wait for all cull and draw threads to complete. 342 viewer.sync(); 343 344 // update the scene by traversing it with the the update visitor which will 345 // call all node update callbacks and animations. 346 viewer.update(); 347 348 // fire off the cull and draw traversals of the scene. 349 viewer.frame(); 350 351 } 309 #else 310 311 osg::notify(osg::NOTICE)<<"osgshaderterrain OpenGL support test not implemented yet"<<std::endl; 352 312 353 // wait for all cull and draw threads to complete. 354 viewer.sync(); 355 356 // run a clean up frame to delete all OpenGL objects. 357 viewer.cleanup_frame(); 358 359 // wait for all the clean up frame to complete. 360 viewer.sync(); 361 362 return 0; 313 #endif 314 315 316 return viewer.run(); 363 317 }
