Time for action - quickly creating simple objects
It is easy to create simple objects by using an osg::Shape
subclass. We will take three typical shapes as examples: a box with different width, height, and depth values, a sphere with a radius value, and a cone with a radius and a height.
- Include necessary headers:
#include <osg/ShapeDrawable> #include <osg/Geode> #include <osgViewer/Viewer>
- Add three
osg::ShapeDrawable
objects successively, each with a type of basic shape. We set these shapes to different positions to make them visible to viewers at the same time, and for the reason of distinguishing them from each other, we color the latter two shapes green and respectively, blue by using thesetColor()
method ofosg::ShapeDrawable:
osg::ref_ptr<osg::ShapeDrawable> ...
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.