Time for action - using a separate data receiver thread

In this example, we will design a new thread with the OpenThreads library and use it to read characters from the standard input. At the same time, the main process, that is, the OSG viewer and rendering backend will try retrieving the input characters and displaying them on the screen with the osgText library. The entire program can only quit normally when the data thread and main process are both completed.

  1. Include the necessary headers:
    #include <osg/Geode>
    #include <osgDB/ReadFile>
    #include <osgText/Text>
    #include <osgViewer/Viewer>
    #include <iostream>
  2. Declare our new DataReceiverThread class as being derived from OpenThreads::Thread. Two virtual methods should be implemented to ensure ...

Get OpenSceneGraph 3.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.