[osg-users] Resize a shape?

Robert Osfield robert.osfield at gmail.com
Wed Oct 24 02:09:47 PDT 2007


Hi Patrick,

After modifiying the shape call dirtyDisplayList() on the
ShapeDrawable to get it to recreate the display list that is passed to
OpenGL.

Robert.

On 10/23/07, Patrick Maier <maierp at gmx.net> wrote:
> Hi,
> I'm new to this list and to openscenegraph and I've a question regarding a
> problem and I don't know how to solve it.
> It should be really trivial, but I don't get it managed, and google or
> other searches could not help me.
>
> I've a cylinder, and while showing the scene, I want to change the size
> (height) of the cylinder.
> I tried it that way, but only the first call of setting the height is a
> success (so the height of the cylinder stays at 0.1):
>
> ===
> osg::Geode* possible_binding = new osg::Geode();
> osg::Cylinder* possible_binding_shape = new
> osg::Cylinder(osg::Vec3(0,0,0), 0.4, 1.0);
> osg::ShapeDrawable* possible_binding_drawable = new
> osg::ShapeDrawable(possible_binding_shape);
> possible_binding->addDrawable(possible_binding_drawable);
>
> [...]
>
> viewer.realize();
> float i = 0;
> while(!viewer.done()){
>         i += 0.1f;
>         ((osg::Cylinder*)(possible_binding->getDrawable(0)->getShape()))->setHeight(i);
>         std::cout << "Main: " <<
> ((osg::Cylinder*)(possible_binding->getDrawable(0)->getShape()))->getHeight()
> << std::endl;
>         viewer.frame();
> }
> ===
>
> What am I doing wrong?
> Sorry if this should be a trivial question, but I don't know the answer.
>
> Thanks a lot!
> Patrick
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list