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::ShapeDrawableobjects 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 the