Time for action—setting polygon modes of different nodes

We are going to select the polygon rasterization mode of a loaded model. The osg::PolygonMode class, which is derived from the osg::StateAttribute base class, will be used to achieve this goal. It simply encapsulates OpenGL's glPolygonMode() function and implements interfaces for specifying face and drawing mode parameters, and thus changes the final rasterization of the attached node.

  1. Include the necessary headers:
    #include <osg/PolygonMode>
    #include <osg/MatrixTransform>
    #include <osgDB/ReadFile>
    #include <osgViewer/Viewer>
    
  2. We will work on the basis of the transformation example in the last chapter. We create two osg::MatrixTransform nodes and make them share the same loaded Cessna model. ...

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.