Basic Shapes

From ARToolworks support library

Jump to: navigation, search

Main Page > osgART > osgART HowTo > Basic Shapes

Contents

Sphere

osg::Shape* sphere = new osg::Sphere(osg::Vec3(10.0f, 10.0f, 10.0f), 5.0f);
osg::ShapeDrawable* sphereDrawable = new osg::ShapeDrawable(sphere);
osg::Geode* sphereGeode = new osg::Geode();
sphereGeode->addDrawable(sphereDrawable);

Box

osg::Shape* box = new osg::Box(osg::Vec3(10.0f, 10.0f, 10.0f), 5.0f);
osg::ShapeDrawable* boxDrawable = new osg::ShapeDrawable(box);
osg::Geode* boxGeode = new osg::Geode();
boxGeode->addDrawable(boxDrawable);

Cone

osg::Shape* cone = new osg::Cone(osg::Vec3(10.0f, 10.0f, 10.0f), 5.0f, 10.0f);
osg::ShapeDrawable* coneDrawable = new osg::ShapeDrawable(cone);
osg::Geode* coneGeode = new osg::Geode();
coneGeode->addDrawable(coneDrawable);

Cylinder

osg::Shape* cylinder = new osg::Cylinder(osg::Vec3(10.0f, 10.0f, 10.0f), 5.0f, 10.0f);
osg::ShapeDrawable* cylinderDrawable = new osg::ShapeDrawable(cylinder);
osg::Geode* cylinderGeode = new osg::Geode();
cylinderGeode->addDrawable(cylinderDrawable);

Capsule

osg::Shape* capsule = new osg::Capsule(osg::Vec3(10.0f, 10.0f, 10.0f), 5.0f, 10.0f);
osg::ShapeDrawable* capsuleDrawable = new osg::ShapeDrawable(capsule);
osg::Geode* capsuleGeode = new osg::Geode();
capsuleGeode->addDrawable(capsuleDrawable);
Personal tools