Hi Dae, add _coord->dirty() after modification. Laurens. On Tue, Sep 17, 2019 at 3:16 AM Dae Woo Ryu <osgfo...@tevs.eu> wrote:
> Hi, > > As shown in the code below, > I get the geometry information from the model of Openflight(.flt) format > and move the coordinates of the vertices. > But the texture doesn't move. > How can I move a texture? > > **main** > > > Code: > > ... > osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("test/env_cloud.flt"); > > coneUpdateVisitor coneV; > model->accept(coneV); > > scene->addChild(model); > ... > > > > > **visitor** > > Code: > > > class coneUpdateVisitor : public osg::NodeVisitor > { > ... > > void apply(osg::Geode& geode) > { > for (unsigned int i = 0; i<geode.getNumDrawables(); ++i) > { > scene->setUpdateCallback(new > coneUpdateCallback(geode.getDrawable(i)->asGeometry())); > } > } > } > > > > > **callback** > > > Code: > > class coneUpdateCallback : public osg::NodeCallback > { > ... > _geom->setUseDisplayList(false); > ... > > virtual void operator()(osg::Node*, osg::NodeVisitor* nv) > { > if (nv->getFrameStamp()) > { > _coord = > dynamic_cast<osg::Vec2Array*>(_geom->getTexCoordArray(0)); > > for (unsigned int u = 0; u < _coord->size(); u++) > { > _coord->at(u).x() += 0.01f; > } > > } > } > } > > > > > > > Thank you! > > Cheers, > Dae > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=76684#76684 > > > > > > _______________________________________________ > 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