Hi Peter,
osg::Sphere is a sublcass from osg::Shape, not a subclass from
osg::Drawable, so its not approrpriate to cast a drawable to a Sphere,
I would expect at least a crash from what you are doing.
Robert.
On 3/4/07, Peter Steibert <[EMAIL PROTECTED]> wrote:
Hello,
At the moment I`m trying to modify a 3D-scene for each frame (Actually,
I want to start with a sphere that changes its center-coordinates or its
radius).
To achieve this goal I used the OSG-example "osgcallback" as a guide to
update the sphere. Here is a code snippet:
struct DrawableUpdateCallback : public osg::Drawable::UpdateCallback
{
float _angle;
virtual void update(osg::NodeVisitor*, osg::Drawable* drawable)
{
if (drawable->getName() == "Sphere")
{
osg::Sphere* sphereShape = (osg::Sphere*)
drawable->getShape();
_angle = _angle + 0.02;
float radius = abs(30*cos(_angle));
sphereShape->setRadius(radius);
}
}
};
The following problem occured: The sphere changes its radius only once
at the beginning of the running program, then the sphere stays unchanged
on the display although the radius definitely has varied. The same also
happens when I change the center-coordinates.
Any help would be welcome.
Thanks in advance,
Peter
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/