Time for action—switching between different threading models

OSG provides a very convenient interface for choosing a threading model. Different threading models can be used in different circumstances, and have different efficiencies. In this example, we are going to show the difference between three common threading models when running a scene with a huge number of quad geometries, in three rendering windows of an osgViewer::CompositeViewer, synchronously.

  1. Include the necessary headers:
    #include <osg/Group>
    #include <osgDB/ReadFile>
    #include <osgViewer/ViewerEventHandlers>
    #include <osgViewer/CompositeViewer>
    
  2. The quads can be generated with the osg::createTexturedQuadGeometry() function. Their positions are decided simply by a random number generator. ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.