[osg-users] Changing shapes attributes

Robert Osfield robert.osfield at gmail.com
Thu Nov 1 02:33:00 PDT 2007


On 11/1/07, Renan Mendes <renanmzmendes at gmail.com> wrote:
> Hello, everyone.
>
>  To achieve my goal in my OSG application, I need the shapes that are on the
> screen to change their colors when selected by mouse picking. All the shapes
> that are on the screen, from the class "Sphere", for instance, have the
> following pattern of inheritance (in which the symbol '->' means that the
> following class inherits the methods from the previous one):
>
>  osg::MatrixTransform -> Primitive -> Sphere
>
>  With this, I mean that a sphere created is a matrix that has a geode
> connected to it, which carries the shape's information on a shapedrawable.
>
> So, how do I change the color of a shape, which is an osg::MatrixTransform
> object, if this attribute is only accessible on osg::ShapeDrawable objects?

You have to traverse down to the ShapeDrawable and change the colour
there.  You'll also need to call dirtyDisplayList() to see the
changes.

Robert.


More information about the osg-users mailing list