[osg-users] Draw trackball (sphere with constant radius)

Bruno Oliveira bruno.manata.oliveira at gmail.com
Tue Apr 5 06:41:29 PDT 2016


Hello,

I have a osg::viewer instance which I manipulate using
TrackballManipulator. I would like to draw the trackball sphere, which
cannot be done with this code because this sphere will be rescaled
everytime I scale my scene view using the mouse wheel:


m_rootNode = new osg::Group();

    // Add trackball sphere
    osg::ref_ptr<osg::Sphere> trackSphere = new osg::Sphere(
osg::Vec3(0,0,0), m_manipulator->getTrackballSize());
    osg::ref_ptr<osg::ShapeDrawable> trackSphereDrawable = new
osg::ShapeDrawable(trackSphere);
    osg::ref_ptr<osg::Geode> trackSphereGeode = new osg::Geode();
    trackSphereGeode->addDrawable(trackSphereDrawable);

    m_rootNode->addChild(trackSphereGeode);


How can I draw a trackball sphere that keeps its size in the window even
when I rescale my scene?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160405/e33e8574/attachment-0002.htm>


More information about the osg-users mailing list