[osg-users] I want to move the texture to rain. Help me.

Robert Osfield robert.osfield at gmail.com
Tue Jul 30 01:57:49 PDT 2019


HI Dae Woo Ryu,

The callback you have shown should be sufficient, but will require you to
do a dirtyDisplayList() on the geomtry to get it to update if you have
display lists enabled.  I'd recommend disabling display lists for this type
of work though, a call to geometry->setUseDisplayLists(false) should be
sufficient.

However, if you are comfortable writing your own shaders by far the most
efficient way to animate texture coordinates is to do it within the vertex
shader.  You can use the osg_SimulationTime uniform that the OSG provides
to get the current time.  Have a look at the
OpenSceneGraph/examples/osgdrawinstanced/osgdrawinstanced.cpp to see an
example of this in action.

Robert.

On Tue, 30 Jul 2019 at 08:43, Dae Woo Ryu <osgforum at tevs.eu> wrote:

> Hi ,robertosfield
>
> Thank you for reply.
>
>
> I want to continue moving the Texture like the code below.
>
> But the coordinates of the texture do not seem to update continuously.
>
> I want the Texture to be updated continuously.
>
>
> Code:
>         virtual void operator()(osg::Node*, osg::NodeVisitor* nv)
>         {
>                 if (nv->getFrameStamp())
>                 {
>                         _texcoords2 =
> dynamic_cast<osg::Vec2Array*>(_geom->getTexCoordArray(0));
>
>                         for (unsigned int u = 0; u < _texcoords2->size();
> u++)
>                         {
>                                 _texcoords2->at(u).x() += 0.001f;
>                                 _texcoords2->at(u).y() += 0.001f;
>
>                         }
>
>
>
>                            ....
>
>
>
>
> Thank you!
>
> Cheers,
> Dae Woo Ryu[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76538#76538
>
>
>
>
>
> _______________________________________________
> 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/20190730/62c11759/attachment.html>


More information about the osg-users mailing list