HI Gianni,

How to go about it will depend upon what you are trying to achieve with
your application.

At the most basic level it's likely that the ShadpeDrawable has created a
display list and you aren't calling dirty to force it rebuild it after the
change in settings to the osg::Sphere, try calling
shapedrawable->dirtyDisplayList(); after you update the Sphere.

While this might fix the immediate problem, it may well be that
ShapeDrawable/Sphere isn't at all the right tool for the problem you are
trying to solve.  ShapeDrawable is really just a very simple way of
visualizing the primitive osg::Shape objects.  These osg::Shape exist to
support collision detection/physics that end users may want to layer on top
of the OSG - this is why you can assign them to osg::Drawable, as they can
form a more accurate representation of an object than the simple
BoundingBox that is used for view frustum culling.  The ShapeDrawable was
really just intended to help debug and for very simple vis tasks, not as a
general purpose visualization tool.

The most efficient way to create data for visualization is using
osg::Geometry where proper OpenGL fast paths can be used so you can get the
best performance and full control over the whole spectrum of vertex
attributes that you don't have with ShapeDrawable/Shape.  If you have large
number of sphere objects you may also want to start looking at point
sprites or geometry instancing.

Robert.

Robert.



On 26 November 2014 at 08:40, Gianni Ambrosio <[email protected]>
wrote:

> Hi All,
> I need to move an osg::Sphere. I tried with setCenter() in vain. Looking
> around I didn't found a solution to redraw the sphere. Isn't there a
> solution different from attaching a PositionAttutudeTransform (or something
> like that) as parent of the Drawable and modify then the transformation
> instead of the sphere center?
>
> Regards,
> Gianni
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=61862#61862
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to