Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Ravi Mathur
There are plenty of osg examples that show how to create your own event
handler by subclassing from GUIEventHandler. For example look at osgpoints.

Make your own event handler, and change the text visibility (using its node
mask) based on whatever keys you choose.

To update text dynamically, use an update callback attached to the Text
node. See the osgcallback example.

---
Ravi

Sent from my phone, please excuse my brevity.

On Thu, Dec 20, 2018, 9:14 PM Sam Brkopac  Use event handlers, node masks or a switch.
>
> Sent from my iPhone
>
> > On Dec 20, 2018, at 5:28 PM, Diego Mancilla 
> wrote:
> >
> > Hello ravi,
> >
> > Thank you for your your answer.
> >
> > What you suggest can be accomplish by the use a visitor or a callback?:
> Lets say that I want to change show/hide the text when the user press a
> key, moreover, if some of the text for  nodes (cessna) should be
> shown/hidden with some key  and others (glider) with another. And at the
> same time, each text varies in time (like if they were their
> positions)...How can I accomplish this?
> >
> > Cheers,
> >
> >
> >
> > ravidavi wrote:
> >> If you will be dynamically changing your text, then specify that when
> you first create it:osgText::Text* text = new osgText::Text;
> >> text->setDataVariance(osg::Object::DYNAMIC);
> >> Note that setting the data variance isimportant for multithreaded
> Viewers (http://forum.openscenegraph.org/viewtopic.php?t=10441=next).
> >>
> >>
> >> Then you can change the text easily:
> >> text->setText("insert dynamically-generated string here");
> >>
> >>
> >> You can show/hide the text with its node mask:
> >> text->setNodeMask(0x0); // NodeMask = 0 to hide
> >> text->setNodeMask(~0x0); // NodeMask = 0x to show
> >>
> >>
> >> Hope that helps,
> >> Ravi
> >>
> >>
> >>
> >> On Thu, Dec 20, 2018 at 8:39 AM Diego Mancilla < ()> wrote:
> >>
> >>
> >>> Hello,
> >>>
> >>>  I have a couple of doubts regarding the proper way of handling
> osg::Text inside an animation.
> >>>
> >>>  For the sake of simplicity lets say we are working on the osganimate
> example, and we have multiple cessna moving around.
> >>>
> >>> 1- What is the proper way of changing the text of osg::Text on
> runtime? For instance, if I want to display current position of cessna.
> >>>
> >>> 2- How can I hide/show the current value of the text on user request
> (stoke of key for example).
> >>>
> >>> Thank you!
> >>>
> >>> Cheers,
> >>>
> >>> --
> >>> Read this topic online here:
> >>> http://forum.openscenegraph.org/viewtopic.php?p=75329#75329 (
> http://forum.openscenegraph.org/viewtopic.php?p=75329#75329)
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> ___
> >>> osg-users mailing list
> >>> ()
> >>>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> )
> >>>
> >>
> >>
> >> --
> >> Post generated by Mail2Forum
> >
> >
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=75333#75333
> >
> >
> >
> >
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Sam Brkopac
Use event handlers, node masks or a switch.

Sent from my iPhone

> On Dec 20, 2018, at 5:28 PM, Diego Mancilla  wrote:
> 
> Hello ravi,
> 
> Thank you for your your answer.
> 
> What you suggest can be accomplish by the use a visitor or a callback?: Lets 
> say that I want to change show/hide the text when the user press a key, 
> moreover, if some of the text for  nodes (cessna) should be shown/hidden with 
> some key  and others (glider) with another. And at the same time, each text 
> varies in time (like if they were their positions)...How can I accomplish 
> this?
> 
> Cheers,
> 
> 
> 
> ravidavi wrote:
>> If you will be dynamically changing your text, then specify that when you 
>> first create it:osgText::Text* text = new osgText::Text;
>> text->setDataVariance(osg::Object::DYNAMIC);
>> Note that setting the data variance isimportant for multithreaded Viewers 
>> (http://forum.openscenegraph.org/viewtopic.php?t=10441=next).
>> 
>> 
>> Then you can change the text easily:
>> text->setText("insert dynamically-generated string here");
>> 
>> 
>> You can show/hide the text with its node mask:
>> text->setNodeMask(0x0); // NodeMask = 0 to hide
>> text->setNodeMask(~0x0); // NodeMask = 0x to show
>> 
>> 
>> Hope that helps,
>> Ravi
>> 
>> 
>> 
>> On Thu, Dec 20, 2018 at 8:39 AM Diego Mancilla < ()> wrote:
>> 
>> 
>>> Hello,
>>> 
>>>  I have a couple of doubts regarding the proper way of handling osg::Text 
>>> inside an animation.
>>> 
>>>  For the sake of simplicity lets say we are working on the osganimate 
>>> example, and we have multiple cessna moving around.
>>> 
>>> 1- What is the proper way of changing the text of osg::Text on runtime? For 
>>> instance, if I want to display current position of cessna.
>>> 
>>> 2- How can I hide/show the current value of the text on user request (stoke 
>>> of key for example). 
>>> 
>>> Thank you!
>>> 
>>> Cheers,
>>> 
>>> --
>>> Read this topic online here:
>>> http://forum.openscenegraph.org/viewtopic.php?p=75329#75329 
>>> (http://forum.openscenegraph.org/viewtopic.php?p=75329#75329)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ___
>>> osg-users mailing list
>>> ()
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
>>> (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
>>> 
>> 
>> 
>> --
>> Post generated by Mail2Forum
> 
> 
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75333#75333
> 
> 
> 
> 
> 
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Diego Mancilla
Hello ravidavi,

 Thank you for your your answer.

 What you suggest can be accomplish by the use a visitor or a callback?: Lets 
say that I want to change show/hide the text when the user press a key, 
moreover, if some of the text for  nodes (cessna) should be shown/hidden with 
some key  and others (glider) with another. And at the same time, each text 
varies in time (like if they were their positions)...How can I accomplish this?

Cheers,



ravidavi wrote:
> If you will be dynamically changing your text, then specify that when you 
> first create it:    osgText::Text* text = new osgText::Text;
>     text->setDataVariance(osg::Object::DYNAMIC);
> Note that setting the data variance isimportant for multithreaded Viewers 
> (http://forum.openscenegraph.org/viewtopic.php?t=10441=next).
> 
> 
> Then you can change the text easily:
>     text->setText("insert dynamically-generated string here");
> 
> 
> You can show/hide the text with its node mask:
>     text->setNodeMask(0x0); // NodeMask = 0 to hide
>     text->setNodeMask(~0x0); // NodeMask = 0x to show
> 
> 
> Hope that helps,
> Ravi
> 
> 
> 
> On Thu, Dec 20, 2018 at 8:39 AM Diego Mancilla < ()> wrote:
> 
> 
> > Hello,
> > 
> >  I have a couple of doubts regarding the proper way of handling osg::Text 
> > inside an animation.
> > 
> >  For the sake of simplicity lets say we are working on the osganimate 
> > example, and we have multiple cessna moving around.
> > 
> > 1- What is the proper way of changing the text of osg::Text on runtime? For 
> > instance, if I want to display current position of cessna.
> > 
> > 2- How can I hide/show the current value of the text on user request (stoke 
> > of key for example). 
> > 
> > Thank you!
> > 
> > Cheers,
> > 
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=75329#75329 
> > (http://forum.openscenegraph.org/viewtopic.php?p=75329#75329)
> > 
> > 
> > 
> > 
> > 
> > ___
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> 
> 
>  --
> Post generated by Mail2Forum


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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Diego Mancilla
Hello ravi,

 Thank you for your your answer.

 What you suggest can be accomplish by the use a visitor or a callback?: Lets 
say that I want to change show/hide the text when the user press a key, 
moreover, if some of the text for  nodes (cessna) should be shown/hidden with 
some key  and others (glider) with another. And at the same time, each text 
varies in time (like if they were their positions)...How can I accomplish this?

Cheers,



ravidavi wrote:
> If you will be dynamically changing your text, then specify that when you 
> first create it:    osgText::Text* text = new osgText::Text;
>     text->setDataVariance(osg::Object::DYNAMIC);
> Note that setting the data variance isimportant for multithreaded Viewers 
> (http://forum.openscenegraph.org/viewtopic.php?t=10441=next).
> 
> 
> Then you can change the text easily:
>     text->setText("insert dynamically-generated string here");
> 
> 
> You can show/hide the text with its node mask:
>     text->setNodeMask(0x0); // NodeMask = 0 to hide
>     text->setNodeMask(~0x0); // NodeMask = 0x to show
> 
> 
> Hope that helps,
> Ravi
> 
> 
> 
> On Thu, Dec 20, 2018 at 8:39 AM Diego Mancilla < ()> wrote:
> 
> 
> > Hello,
> > 
> >  I have a couple of doubts regarding the proper way of handling osg::Text 
> > inside an animation.
> > 
> >  For the sake of simplicity lets say we are working on the osganimate 
> > example, and we have multiple cessna moving around.
> > 
> > 1- What is the proper way of changing the text of osg::Text on runtime? For 
> > instance, if I want to display current position of cessna.
> > 
> > 2- How can I hide/show the current value of the text on user request (stoke 
> > of key for example). 
> > 
> > Thank you!
> > 
> > Cheers,
> > 
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=75329#75329 
> > (http://forum.openscenegraph.org/viewtopic.php?p=75329#75329)
> > 
> > 
> > 
> > 
> > 
> > ___
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> 
> 
>  --
> Post generated by Mail2Forum


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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Working with osg::Text on animation

2018-12-20 Thread Ravi Mathur
If you will be dynamically changing your text, then specify that when you
first create it:
osgText::Text* text = new osgText::Text;
text->setDataVariance(osg::Object::DYNAMIC);
Note that setting the data variance is important for multithreaded Viewers
.

Then you can change the text easily:
text->setText("insert dynamically-generated string here");

You can show/hide the text with its node mask:
text->setNodeMask(0x0); // NodeMask = 0 to hide
text->setNodeMask(~0x0); // NodeMask = 0x to show

Hope that helps,
Ravi

On Thu, Dec 20, 2018 at 8:39 AM Diego Mancilla  wrote:

> Hello,
>
>  I have a couple of doubts regarding the proper way of handling osg::Text
> inside an animation.
>
>  For the sake of simplicity lets say we are working on the osganimate
> example, and we have multiple cessna moving around.
>
> 1- What is the proper way of changing the text of osg::Text on runtime?
> For instance, if I want to display current position of cessna.
>
> 2- How can I hide/show the current value of the text on user request
> (stoke of key for example).
>
> Thank you!
>
> Cheers,
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75329#75329
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Working with osg::Text on animation

2018-12-20 Thread Diego Mancilla
Hello,

 I have a couple of doubts regarding the proper way of handling osg::Text 
inside an animation.

 For the sake of simplicity lets say we are working on the osganimate example, 
and we have multiple cessna moving around.

1- What is the proper way of changing the text of osg::Text on runtime? For 
instance, if I want to display current position of cessna.

2- How can I hide/show the current value of the text on user request (stoke of 
key for example). 

Thank you!

Cheers,

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org