| 233 | | unsigned int pos = viewer.addCameraManipulator(new TestManipulator); |
| 234 | | viewer.selectCameraManipulator(pos); |
| 235 | | |
| 236 | | // get details on keyboard and mouse bindings used by the viewer. |
| 237 | | viewer.getUsage(*arguments.getApplicationUsage()); |
| 238 | | |
| 239 | | // if user request help write it out to cout. |
| 240 | | if (arguments.read("-h") || arguments.read("--help")) |
| 241 | | { |
| 242 | | arguments.getApplicationUsage()->write(std::cout); |
| 243 | | return 1; |
| 244 | | } |
| 245 | | |
| 246 | | // any option left unread are converted into errors to write out later. |
| 247 | | arguments.reportRemainingOptionsAsUnrecognized(); |
| 248 | | |
| 249 | | // report any errors if they have occured when parsing the program aguments. |
| 250 | | if (arguments.errors()) |
| 251 | | { |
| 252 | | arguments.writeErrorMessages(std::cout); |
| 253 | | return 1; |
| 254 | | } |
| | 225 | viewer.setCameraManipulator(new TestManipulator); |
| 320 | | // register trackball, flight and drive. |
| 321 | | |
| 322 | | // create the windows and run the threads. |
| 323 | | viewer.realize(); |
| 324 | | |
| 325 | | while( !viewer.done() ) |
| 326 | | { |
| 327 | | // wait for all cull and draw threads to complete. |
| 328 | | viewer.sync(); |
| 329 | | |
| 330 | | // update the scene by traversing it with the the update visitor which will |
| 331 | | // call all node update callbacks and animations. |
| 332 | | viewer.update(); |
| 333 | | |
| 334 | | // fire off the cull and draw traversals of the scene. |
| 335 | | viewer.frame(); |
| 336 | | |
| 337 | | } |
| 338 | | |
| 339 | | // wait for all cull and draw threads to complete. |
| 340 | | viewer.sync(); |
| 341 | | |
| 342 | | // run a clean up frame to delete all OpenGL objects. |
| 343 | | viewer.cleanup_frame(); |
| 344 | | |
| 345 | | // wait for all the clean up frame to complete. |
| 346 | | viewer.sync(); |
| 347 | | |
| 348 | | return 0; |
| | 291 | return viewer.run(); |