Time for action—enabling global multisampling

Multisampling is a type of anti-aliasing technique. It can improve the final result's quality without much performance hit. User applications should set a sampling number for implementing multisample rasterization. Note that not all graphics cards support the multisampling extension, thus this example may fail on some systems and platforms.

  1. Include the necessary headers:
    #include <osgDB/ReadFile>
    #include <osgViewer/Viewer>
    
  2. Set the number of multisamples. Available values often include 2, 4, and 6, depending on specific graphics devices:
    osg::DisplaySettings::instance()->setNumMultiSamples( 4 );
    
  3. Load a model and render it with a standard viewer. The global multisampling attribute managed by the osg::DisplaySettings ...

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.