Hmmm... OK.

I want to replace an existing node of a scene by a new one.
I do this by calling setNode in a switch but the scene doesn't recognize the 
change.


On Thursday 16 September 2010 12:28:25 Robert Osfield wrote:
> Hi Werner,
> 
> Please stop diving into discussing a specific implementation in code.
> Please step back and do as I requested.  Explain what you are trying
> to do at higher level, I asked you to do this for a reason - I can't
> really help properly when you dive down to low level code.
> 
> Robert.
> 
> On Thu, Sep 16, 2010 at 11:24 AM, Werner Modenbach
> 
> <[email protected]> wrote:
> > OK, I'll do my best...
> > 
> > My app is a Qt app and I'm using AdapterWidget in single threaded mode as
> > recommended.
> > My global scene is a switch "bigScene" and one child is my node "scene"
> > which is also a switch.
> > Both are permanent variables stored using  osg::ref_ptr.
> > 
> > "scene" has many leaves, each representing a yarn in the textile.
> > They are  just temporary variables attached to the "scene" by calling
> >        scene->addNode(yarnNumber, yarn.get());
> > or after changes by
> >        scene->setNode(yarnNumber, yarn.get());
> > Also the temporaryly used nodes are stored in osg::ref_ptr.
> > 
> > Now it comes to dynamic:
> > Physical effects changing the "fabric" are calculated in threads but the
> > results are giveb to my view in the main display thread - this is
> > ensured!
> > 
> > When knowing the yarn has changed, I create a NEW geometry, attach it to
> > a NEW yarn node and call "scene->setNode(...);" as described above. So
> > everything is done in one single main thread.
> > 
> > What I recognized is:
> > 1) When just calling "scene->setNode(...);" the displayed scene doesn't
> > change.
> > 2) When calling "bigScene->setNode(0), scene.get()" again, I see all my
> > changes.
> > 
> > My questions:
> > 1) Is it recommended to replace some node just like that? Any problems
> > with caching etc.?
> > 2) Why does "bigScene" not recognize the change of the leafes?
> > 
> > Also when doing big fabrics and using trackball frequently the program is
> > terminated with a message like "Error from GL driver" (not exact).
> > 
> > I hope I could give you enough info. Thanks for your kind support.
> > 
> > - Werner -
> > 
> > On Thursday 16 September 2010 11:56:02 Robert Osfield wrote:
> >> Hi Werner,
> >> 
> >> Could you back out a bit, and introduce the problem your are tackling
> >> at a high level so that others get a picture about what you are trying
> >> to achieve, diving into what solution you've code is often premature.
> >> 
> >> From what I can gather integration of the simulation code and
> >> rendering code is at the core of what you are trying to achieve.
> >> Could you explain more about the simulation code, such as how it's
> >> threaded, is synchronous to the rendering thread etc.  Also on the
> >> rendering side, how do you want to render it?
> >> 
> >> Robert.
> >> 
> >> On Thu, Sep 16, 2010 at 10:36 AM, Werner Modenbach
> >> 
> >> <[email protected]> wrote:
> >> > OK Robert,
> >> > 
> >> > I still have the impression I have exactly the same case as Dženan.
> >> > But if you prefer I'll open a new thread.
> >> > I'm using AdapterWidget in Qt and I'm running it single threaded as
> >> > Dženan does.
> >> > I'm replacing a node in the scene graph by a newly created one.
> >> > 
> >> > Here is my scene hierarchie:
> >> > 
> >> > osg::ref_ptr<osg::Switch> bigScene;        // The whole scene
> >> > 
> >> > My textile:
> >> >        osg::ref_ptr<osg::Switch> scene;        // Textile fabric
> >> > attached to the whole scene by
> >> >        bigScene->setNode(0, scene.get());
> >> > 
> >> > scene has many nodes representing one textile thread each, defines as
> >> >        osg::ref_ptr<osg::Node> yarn;
> >> > attached to scene by
> >> >        scene->setNode(yarnNumber, yarn.get());
> >> > 
> >> > I sayed I have to recalculate the geometry of the yarn nodes
> >> > frewuently. This is done by creating a NEW geometry and a NEW yarn
> >> > node, the replacing the old yarn node by the new one calling:
> >> >        scene->setNode(yarnNumber, yarn.get());
> >> > 
> >> > So what I actually do is replacing an existing node by a new one.
> >> > When doing just that, my bigScene doesn't recognize the changed
> >> > leafes. But after calling
> >> >        bigScene->setNode(position, scene.get());
> >> > 
> >> > again - with the same scene.get() as before - the changes were
> >> > recognized immediately.
> >> > I know my approach maybe incorrect but I'm also just at the beginning
> >> > of my work with osg.
> >> > 
> >> > - Werner -
> >> > _______________________________________________
> >> > 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.or
> >> g
> > 
> > --
> > TEXION Software Solutions
> > 
> > TEXION GmbH -  Rotter Bruch 26a  -  D 52068 Aachen - HRB 14999 Aachen
> > Fon: +49 241 475757-0, Fax: +49 241 475757-29, web: http://www.texion.eu
> > 
> > Geschäftsführer/Managing Director: Werner Modenbach
> > _______________________________________________
> > 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

-- 
TEXION Software Solutions

TEXION GmbH -  Rotter Bruch 26a  -  D 52068 Aachen - HRB 14999 Aachen
Fon: +49 241 475757-0, Fax: +49 241 475757-29, web: http://www.texion.eu

Geschäftsführer/Managing Director: Werner Modenbach
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to