<div dir="ltr">Hi Dae,<div>add <div>_coord->dirty()</div><div>after modification.</div><div>Laurens. <br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 17, 2019 at 3:16 AM Dae Woo Ryu <<a href="mailto:osgforum@tevs.eu">osgforum@tevs.eu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
As shown in the code below, <br>
I get the geometry information from the model of Openflight(.flt) format and move the coordinates of the vertices.<br>
But the texture doesn't move.<br>
How can I move a texture?<br>
<br>
**main**<br>
<br>
<br>
Code:<br>
<br>
...<br>
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("test/env_cloud.flt");<br>
<br>
coneUpdateVisitor coneV;<br>
model->accept(coneV);<br>
<br>
scene->addChild(model);<br>
...<br>
<br>
<br>
<br>
<br>
**visitor**<br>
<br>
Code:<br>
<br>
<br>
class coneUpdateVisitor : public osg::NodeVisitor<br>
{<br>
...<br>
<br>
void apply(osg::Geode& geode)<br>
{<br>
for (unsigned int i = 0; i<geode.getNumDrawables(); ++i)<br>
{<br>
scene->setUpdateCallback(new coneUpdateCallback(geode.getDrawable(i)->asGeometry()));<br>
}<br>
}<br>
}<br>
<br>
<br>
<br>
<br>
**callback**<br>
<br>
<br>
Code:<br>
<br>
class coneUpdateCallback : public osg::NodeCallback<br>
{<br>
...<br>
_geom->setUseDisplayList(false);<br>
...<br>
<br>
virtual void operator()(osg::Node*, osg::NodeVisitor* nv)<br>
{<br>
if (nv->getFrameStamp())<br>
{<br>
_coord = dynamic_cast<osg::Vec2Array*>(_geom->getTexCoordArray(0));<br>
<br>
for (unsigned int u = 0; u < _coord->size(); u++)<br>
{<br>
_coord->at(u).x() += 0.01f;<br>
}<br>
<br>
}<br>
}<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Dae<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=76684#76684" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=76684#76684</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>