OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

I want to move the texture to rain. Help me.


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
newlife958
Newbie


Joined: 24 Jul 2019
Posts: 5
Location: South, Korea

PostPosted: Thu Jul 25, 2019 12:06 am    Post subject:
I want to move the texture to rain. Help me.
Reply with quote

Hi,All.

After applying the texture to the cones.
I want to let the texture run down.
Just like the rain.
Is there no way?
Let me know how.

Texture2d, TexGen, TexGenNode could be used to implement it?
I do not know how to do it.



Thank you!

Cheers,
RYUDAEWOO Shocked Evil or Very Mad
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12336

PostPosted: Mon Jul 29, 2019 4:48 pm    Post subject:
I want to move the texture to rain. Help me.
Reply with quote

Hi,


It's hard to know what you are actually after.  Is it simply that you want the texture coordinates to be updated?  There a number of different ways to do this, how you'd want to do it depends on what you are wanting to do, and the performance constraints you have.  Could you explain what you mean at a lower level, and let us know just how many objects you want to render with this effect.



Robert.



On Mon, 29 Jul 2019 at 12:33, Dae Woo Ryu < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,All.

After applying the texture to the cones.
I want to let the texture run down.
Just like the rain.
Is there no way?
Let me know how.

Texture2d, TexGen, TexGenNode could be used to implement it?
I do not know how to do it.



Thank you!

Cheers,
RYUDAEWOO  Shocked  Evil or Very Mad

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76486#76486





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
newlife958
Newbie


Joined: 24 Jul 2019
Posts: 5
Location: South, Korea

PostPosted: Tue Jul 30, 2019 7:36 am    Post subject:
Reply with quote

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]
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12336

PostPosted: Tue Jul 30, 2019 8:58 am    Post subject:
I want to move the texture to rain. Help me.
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
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
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
newlife958
Newbie


Joined: 24 Jul 2019
Posts: 5
Location: South, Korea

PostPosted: Thu Aug 01, 2019 6:19 am    Post subject:
Reply with quote

Hi,Robert

It really helped me a lot.

I'd really appreciate that.

Thank you!

Cheers,
Dae
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How do I move a Texture in an model ... newlife958 General 4 Tue Sep 17, 2019 1:16 am View latest post
No new posts Render to Texture and osgQt (osgQOpenGL) wroos General 2 Mon Sep 16, 2019 5:47 pm View latest post
No new posts How to resize/move existing OSG windo... mgreene General 1 Thu May 30, 2019 7:36 pm View latest post
No new posts 回复: Is it possible to load text... GarfieldPig General 118 Fri May 10, 2019 4:32 pm View latest post
No new posts Is it possible to load texture withou... robertosfield General 9 Thu May 09, 2019 8:29 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP