Hi Peter,
There are two possible solutions.
The first one is to use a PositionAttitudeTransform(PAT) above the Sphere
geode, and set the callback to the PAT. The second one, is to call
dirtyDisplayList() method or set the use of display lists to false
(setUseDisplayList method) , but I don't recommend last one.
OSG compiles display lists by default for all drawables, that's the reason
becouse your Sphere remains unchaged.
Rafa.
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/