Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

2019-09-20 Thread Robert Osfield
Hi Chris,

My guess is that the deep copy support wasn't built in when I wrote it.
Different parts of the OSG developed at different points so sometimes you
get little inconsistencies.  Feel free to modify the code to do a deep copy
when requested and generate a PR for it.

Robert.



On Fri, 20 Sep 2019 at 19:54, Chris Djali  wrote:

> Hi,
>
> Is it intentional that using osg::CopyOp::DEEP_COPY_USERDATA copies the
> UserDataContainer, but doesn't deep-copy the actual things in it unless
> osg::CopyOp::DEEP_COPY_OBJECTS is also enabled? This means that things can
> be added or removed, but changes to existing things are shared.
>
> We have a situation where we only want to deep-copy the userdata and not
> anything else, so can't set the deep-copy objects flag. This could be
> supported either by ORing objects into the copy op in the userdata
> container copy constructor, or by adding another copy op for copying
> userdata even more deeply, otherwise we're going to have to manually
> implement a less pretty workaround.
>
> Cheers,
> Chris
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76725#76725
>
>
>
>
>
> ___
> 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] DEEP_COPY_USERDATA isn't that deep

2019-09-20 Thread Chris Djali
Hi,

Is it intentional that using osg::CopyOp::DEEP_COPY_USERDATA copies the 
UserDataContainer, but doesn't deep-copy the actual things in it unless 
osg::CopyOp::DEEP_COPY_OBJECTS is also enabled? This means that things can be 
added or removed, but changes to existing things are shared.

We have a situation where we only want to deep-copy the userdata and not 
anything else, so can't set the deep-copy objects flag. This could be supported 
either by ORing objects into the copy op in the userdata container copy 
constructor, or by adding another copy op for copying userdata even more 
deeply, otherwise we're going to have to manually implement a less pretty 
workaround.

Cheers,
Chris

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





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


Re: [osg-users] Render to Texture and osgQt (osgQOpenGL)

2019-09-20 Thread Wouter Roos
Finally had some time to look at it in more detail and it was a problem on my 
side, all is working now with setting the default fbo id. I've made a pull 
request, thanks again for the pointer.

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





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


Re: [osg-users] Custom cursor problem?

2019-09-20 Thread tom joe
Hi,

Changing cursor file to .png/.jpg works fine.
I will look into Win32 cursor setting as well.


Thank you!

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





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


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

2019-09-20 Thread Trajce Nikolov NICK
Hi,

I don't think you should call  _geom->setUseVertexBufferObjects(true);
here. I bet the flt plugin is setting this on creation time. If you have a
use case code you can share and the model it will help more for me to see
what is going on

On Fri, Sep 20, 2019 at 10:19 AM Dae Woo Ryu  wrote:

> hi NICK.
> Thank you for your reply.
>
> I did what you tried and nothing changed.
> Can you tell me another way?
>
> Here is the code I did.
>
> Code:
>
> virtual void operator()(osg::Node*, osg::NodeVisitor* nv)
> {
> if (nv->getFrameStamp())
> {
> if (_coord)
> {
> for (unsigned int u = 0; u < _coord->size(); u++)
> {
> _coord->at(u).x() += 0.6f;
> _coord->at(u).y() += 0.6f;
> _coord->dirty();
> }
> _geom->setUseVertexBufferObjects(true);
> _coord->getBufferObject()->dirty();
> }
> }
> }
>
>
>
>
>
>
> Trajce Nikolov NICK wrote:
> >
> > You may need to call _coord->getBufferObject()->dirty() and do it
> outside of the for loop
> >
> > On Wed, Sep 18, 2019, 02:34 Dae Woo Ryu < ()> wrote:
> >
> >
> > > hi Laurens.
> > > Thank you for the your reply.
> > >
> > > I've tried adding dirty() and it still doesn't work.
> > >
> > > Code:
> > >
> > > virtual void operator()(osg::Node*, osg::NodeVisitor* nv)
> > > {
> > > if (nv->getFrameStamp())
> > > {
> > > _coord =
> dynamic_cast(_geom->getTexCoordArray(0));
> > >
> > > if (_coord)
> > > {
> > > for (unsigned int u = 0; u < _coord->size();
> u++)
> > > {
> > > _coord->at(u).x() += 0.01f;
> > > _coord->at(u).y() += 0.01f;
> > > _coord->dirty();
> > > _geom->dirtyDisplayList();
> > > }
> > > }
> > > }
> > > }
> > >
> > >
> > >
> > > What should I do more?
> > >
> > >
> > > Voerman, L. wrote:
> > >
> > > > Hi Dae,add _coord->dirty()
> > > > after modification.
> > > > Laurens.
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Sep 17, 2019 at 3:16 AM Dae Woo Ryu < ()> 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 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 > > > > {
> > > > > 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(_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 (
> http://forum.openscenegraph.org/viewtopic.php?p=76684#76684) (
> http://forum.openscenegraph.org/viewtopic.php?p=76684#76684 (
> http://forum.openscenegraph.org/viewtopic.php?p=76684#76684))
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ___
> > > > > osg-users mailing list
> > > > >   ()
> > > > >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 

Re: [osg-users] [osgPlugins] Lua: deterministic destruction of the script engine / leaks caused by circular references

2019-09-20 Thread Robert Osfield
Hi Hannes,

Thanks for detailing the issue so clearly.  On a first pass it would seem
like your suggesting of changing to observer_ptr<> would be appropriate.
I'll need to properly review it, though I'm working flat out on the VSG
right now so can't jump in right away.  Could you make a PR for your fix,
then once I get a breather from the VSG work can jump in a test out the
issue and the solution.

Cheers,
Robert.

On Thu, 19 Sep 2019 at 22:29, Hannes Pabst 
wrote:

> Consider the following Lua script
>
>
> Code:
>
> function makeObjectWithCallback()
>local object = new "osg::Object"
>
>function object:process()
>  print "Hello"
>end
>
>return object
> end
>
>
>
>
> The function makeObjectWithCallback will create an osg::Object which has a
> LuaCallbackObject named "process", stored within its user data.
> The LuaCallbackObject itself stores an ref_ptr to the LuaScriptEngine for
> being able to call the function defined within Lua.
> Unfortunately the references now are circular:
>
> LuaScriptEngine -> Lua -> Object -> LuaCallbackObject -> LuaScriptEngine
>
> Once the script is executed it is hard to get rid of the LuaScriptEngine
> object.
> Simply deleting all references to the ScriptEngine and the returned Object
> on the cpp side will cause a leak, as the Lua state keeps them alive.
> Even if the variable "object" above is only temporarily used in Lua, a GC
> run is necessary to break the Lua -> Object dependency.
> But who shall trigger that, if all references on the cpp side are gone and
> Lua cannot be called anymore?
>
> Here is the code to run the Lua script above, that will produce the leak:
>
>
> Code:
>
> void runScript()
> {
>osg::ref_ptr luaScriptEngine =
> osgDB::readFile("ScriptEngine.lua");
>osg::ref_ptr script = osgDB::readScriptFile("script.lua");
>osg::Parameters inputParameters;
>osg::Parameters outputParameters;
>luaScriptEngine->run(script.get(), "makeObjectWithCallback",
> inputParameters, outputParameters);
> }
>
>
>
>
> My intention is to use LuaCallbackObjects but also to have the possibility
> to clean up and reload the Lua script at any time by re-instantiating the
> LuaScriptEngine.
> Unfortunately there seems to be no general and easy way to destroy the
> shared LuaScriptEngine object.
>
> Wouldn't it be a more practical design to have the LuaCallbackObject only
> weakly reference the LuaScriptEngine?
> If the ScriptEngine object is gone, callbacks into Lua could simply do
> nothing – per definition.
> I understand such change would break existing code, in situations where
> one creates a LuaScriptEngine object on the fly running a script that hooks
> to the OSG runtime system.
> As far as I understand the Lua plugin code, the lua_close call in the
> destructor of LuaScriptEngine releases all references held by Lua and thus
> would be able break up all other eventually existing circular references -
> so the class would in principle be ready to act as a “master object” on the
> cpp side, that is able to control the lifetime of the whole Lua system.
>
> I have made this change to the Lua plugin code (simply by replacing the
> ref_ptr by an observer_ptr) and for my purposes it seems to work well, but
> wonder if this is an issue that should generally be addressed within OSG.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76703#76703
>
>
>
>
>
> ___
> 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] How do I move a Texture in an model of Openflight format (.flt) in the UV direction?

2019-09-20 Thread Dae Woo Ryu
hi NICK.
Thank you for your reply.

I did what you tried and nothing changed.
Can you tell me another way?

Here is the code I did.

Code:

virtual void operator()(osg::Node*, osg::NodeVisitor* nv)
{   
if (nv->getFrameStamp())
{   
if (_coord)
{
for (unsigned int u = 0; u < _coord->size(); u++)
{
_coord->at(u).x() += 0.6f;
_coord->at(u).y() += 0.6f;
_coord->dirty();
}
_geom->setUseVertexBufferObjects(true);
_coord->getBufferObject()->dirty();
}
}
}






Trajce Nikolov NICK wrote:
> 
> You may need to call _coord->getBufferObject()->dirty() and do it outside of 
> the for loop
> 
> On Wed, Sep 18, 2019, 02:34 Dae Woo Ryu < ()> wrote:
> 
> 
> > hi Laurens.
> > Thank you for the your reply.
> > 
> > I've tried adding dirty() and it still doesn't work.
> > 
> > Code:
> > 
> > virtual void operator()(osg::Node*, osg::NodeVisitor* nv)
> > {
> >         if (nv->getFrameStamp())
> >         {       
> >                 _coord = 
> > dynamic_cast(_geom->getTexCoordArray(0));
> > 
> >                 if (_coord)
> >                 {
> >                         for (unsigned int u = 0; u < _coord->size(); u++)
> >                         {
> >                                 _coord->at(u).x() += 0.01f;
> >                                 _coord->at(u).y() += 0.01f;
> >                                 _coord->dirty();
> >                                 _geom->dirtyDisplayList();
> >                         }
> >                 }
> >         }
> > }
> > 
> > 
> > 
> > What should I do more?
> > 
> > 
> > Voerman, L. wrote:
> > 
> > > Hi Dae,add _coord->dirty()
> > > after modification.
> > > Laurens. 
> > > 
> > > 
> > > 
> > > 
> > > On Tue, Sep 17, 2019 at 3:16 AM Dae Woo Ryu < ()> 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 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 > > >         {
> > > >         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(_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 
> > > > (http://forum.openscenegraph.org/viewtopic.php?p=76684#76684) 
> > > > (http://forum.openscenegraph.org/viewtopic.php?p=76684#76684 
> > > > (http://forum.openscenegraph.org/viewtopic.php?p=76684#76684))
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > ___
> > > > osg-users mailing list
> > > >   ()
> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > >  
> > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > > >  
> > > > (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=76688#76688 
> >