[osg-users] How do I move a Texture in an model of Openflight format (.flt) in the UV direction?

Voerman, L. l.voerman at rug.nl
Tue Sep 17 00:18:09 PDT 2019


Hi Dae,
add
_coord->dirty()
after modification.
Laurens.

On Tue, Sep 17, 2019 at 3:16 AM Dae Woo Ryu <osgforum at 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 at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190917/ee257ea9/attachment.html>


More information about the osg-users mailing list