On Wed, 2011-08-10 at 12:35 +0200, Ankur Gandhi wrote:
> Dear All,
>
> I am making a scene graph in OSG and things are going great. Extensive
> support is available in forums and tutorials of OSG. Thanks a lot for that.
>
> I have one doubt. It may not be related to OSG but may be related general
> application development based on OSG.
>
> To update my scenegraph periodically, I want to use timer. I want a
> particular function to be called every few seconds or so.
>
> In GTK, I used to use g_timeout_add() function. However I believe OSG doesn't
> use g_main_loop() inside its render API. is it correct?
No, it doesn't.
> Can some one tell me equivalent API for g_timeout_add() for OSG based
> application? or is there any other way to implement timer callback in OSG?
There must be at least 200 different ways to do this. :)
If it's just one Node you want updated, then create a NodeCallback
object and fetch the elapsed time from:
NodeVisitor->getFrameStamp()->getSimulationTime()
If you want to visit your entire scenegraph instead, have this Node
create a NodeVisitor and let it visit the subgraph.
You could also replace your call to viewer.run() with manual calls to
realize/frame/etc., but I still recommend the first method. :)
> Thanks in advance!
>
> Cheers,
> Ankur
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=41972#41972
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org