Hi NiuHeming, Most likely problem is that your geometry has display lists enabled and it hasn't been told that its now out of date so isn't updated.
If you are dynamically updating a geometry then its best to turn of display lists via geometry->setUseDisplayLists(false); Or if you update very occassionally then on after each batch of changes you need a geometry->dirtyDisplayList(); Robert. 2008/3/19 Niuheming <[EMAIL PROTECTED]>: > > > Hi, > I want to write a class from osg::Drawable::UpdateCallback to update a > Geometry call named geom,but there is no update happen.I dot't know what's > wrong.Does someone knows? > Thanks in advance! > NiuHeming > > class niuhm : public osg::Drawable::UpdateCallback > { > public: > niuhm(const osg::Vec3& v11,const osg::Vec3& v22,const osg::Vec3& > v33) > { > v1=v11; > v2=v22; > v2=v33; > > bs.radius()*=1.5f; > bs=osg::BoundingSphere(osg::Vec3(0.0f,0.0f,0.0f),4.0f); > bb.expandBy(bs); > } > >   ; virtual void update(osg::NodeVisitor* nv, osg::Drawable* node) > { > osg::Geometry* geom = dynamic_cast<osg::Geometry*>(node); > const osg::FrameStamp* frameStamp = nv->getFrameStamp(); > if (geom && frameStamp) > { > osg::PositionAttitudeTransform* mt = new > osg::PositionAttitudeTransform(); > { > // set up the animation path > osg::AnimationPath* animationPath = new > osg::AnimationPath; > > animationPath->insert(0.0,osg::AnimationPath::ControlPoint(bb.corner(0))); > animationPath->inse > rt(1.0,osg::AnimationPath::ControlPoint(bb.corner(1))); > > animationPath->insert(2.0,osg::AnimationPath::ControlPoint(bb.corner(2))); > > animationPath->insert(3.0,osg::AnimationPath::ControlPoint(bb.corner(3))); > > animationPath->insert(4.0,osg::AnimationPath::ControlPoint(bb.corner(0))); > > animationPath->setLoopMode(osg::AnimationPath::SWING); > &nbs p; mt->setUpdateCallback(new > osg::AnimationPathCallback(animationPath)); > } > > // create marker for point light. > osg::Vec3 vertices = mt->getPosition(); > > unsigned int noXSteps = 100; > unsigned int noYSteps = 100; > > osg::Vec3Array* coords = new osg::Vec3Array; > coords->reserve(noXSteps*noYSteps); > > > osg::Vec3 dx = (v2-v1)/((float)noXSteps-1.0f); > &nbs p; osg::Vec3 dy = (v3-v1)/((float)noYSteps-1.0f); > unsigned int rowvertices; > unsigned int colvertices; > rowvertices=(unsigned > int)((vertices._v[0])/(dx._v[0])); > colvertices=(unsigned > int)((vertices._v[1])/(dy._v[1])); > > unsigned int row; > & nbsp; osg::Vec3 vRowStart = v1; > for(row=0;row<noYSteps;++row){ > osg::Vec3 v = vRowStart; > for(unsigned int col=0;col<noXSteps;++col){ > if ((row==rowvertices)&&(col==colvertices)) > > coords->push_back(v+osg::Vec3(0.0f,0.0f,-1.0f)); > else > coords->push_back(v); > v += dx; > } > vRowStart+=dy; > } > > geom->setVertexArray(coords); > } > > } > osg::Vec3 v1; > osg::Vec3 v2; > osg::Vec3 v3; > osg::BoundingSphere bs; > osg::BoundingBox bb; > }; > > ________________________________ > "七件武器,七种完美" 立刻体验! > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org