[osg-users] Viewer/CompositeViewer inconsistency?
CompositeViewer::checkNeedToDoFrame() does the following: Code: if (_requestRedraw) return true; if (_requestContinousUpdate) return true; for(RefViews::iterator itr = _views.begin(); itr != _views.end(); ++itr) { osgViewer::View* view = itr->get(); if (view) { // If the database pager is going to update the scene the render flag is // set so that the updates show up if (view->getDatabasePager()->requiresUpdateSceneGraph() || view->getDatabasePager()->getRequestsInProgress()) return true; } } // now do a eventTraversal to see if any events might require a new frame. eventTraversal(); if (_requestRedraw) return true; if (_requestContinousUpdate) return true; return false; and Viewer::checkNeedToDoFrame() does: Code: if (_requestRedraw) return true; if (_requestContinousUpdate) return true; // If the database pager is going to update the scene the render flag is // set so that the updates show up if(getDatabasePager()->requiresUpdateSceneGraph() || getDatabasePager()->getRequestsInProgress()) return true; // if there update callbacks then we need to do frame. if (_camera->getUpdateCallback()) return true; if (getSceneData()!=0 && getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true; // now do a eventTraversal to see if any events might require a new frame. eventTraversal(); // now check if any of the event handles have prompted a redraw. if (_requestRedraw) return true; if (_requestContinousUpdate) return true; return false; CompositeViewer works great in my case and calls frame() only when needed. When I make the few changes required to use Viewer, it will always call frame(). In my case, Viewer returns true because getNumChildrenRequiringUpdateTraversal() == 2 and it never goes to 0. If I manually set it to 0, everything works just fine. Am I doing something wrong? It seems odd that the methods do not quite do the same thing. Should these two methods be more consistent?[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43645#43645 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Hi Thomas, The Viewer::checkNeedToDoFrame() looks correct, and CompositeViewer one is missing the check for update callbacks in the scene graph. I have added the missing checks and checked this into svn/trunk. This fix will break the behavior you looking for in your app though, but it'll be correct as one can't assume that no frame is required if there are update callbacks attached to the scene graph that require frame to be called for. Perhaps you have update callbacks on the scene graph that you don't require, or perhaps your update callbacks aren't critical, however, the OSG itself can't decide this and has to assume that if update callbacks exist they have to be honoured. However, there is nothing stopping for you implementing your own viewer frame loop to run the frame loop anyhow you see fit. Robert. On Mon, Oct 31, 2011 at 3:10 PM, Thomas Lerman wrote: > CompositeViewer::checkNeedToDoFrame() does the following: > Code: > if (_requestRedraw) return true; > if (_requestContinousUpdate) return true; > > for(RefViews::iterator itr = _views.begin(); > itr != _views.end(); > ++itr) > { > osgViewer::View* view = itr->get(); > if (view) > { > // If the database pager is going to update the scene the render > flag is > // set so that the updates show up > if (view->getDatabasePager()->requiresUpdateSceneGraph() || > view->getDatabasePager()->getRequestsInProgress()) return true; > } > } > > // now do a eventTraversal to see if any events might require a new frame. > eventTraversal(); > > if (_requestRedraw) return true; > if (_requestContinousUpdate) return true; > > return false; > > and Viewer::checkNeedToDoFrame() does: > Code: > if (_requestRedraw) return true; > if (_requestContinousUpdate) return true; > > > // If the database pager is going to update the scene the render flag is > // set so that the updates show up > if(getDatabasePager()->requiresUpdateSceneGraph() || > getDatabasePager()->getRequestsInProgress()) return true; > > // if there update callbacks then we need to do frame. > if (_camera->getUpdateCallback()) return true; > if (getSceneData()!=0 && > getSceneData()->getNumChildrenRequiringUpdateTraversal()>0) return true; > > // now do a eventTraversal to see if any events might require a new frame. > eventTraversal(); > > // now check if any of the event handles have prompted a redraw. > if (_requestRedraw) return true; > if (_requestContinousUpdate) return true; > > return false; > > CompositeViewer works great in my case and calls frame() only when needed. > When I make the few changes required to use Viewer, it will always call > frame(). In my case, Viewer returns true because > getNumChildrenRequiringUpdateTraversal() == 2 and it never goes to 0. If I > manually set it to 0, everything works just fine. Am I doing something wrong? > It seems odd that the methods do not quite do the same thing. Should these > two methods be more consistent?[/code] > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=43645#43645 > > > > > > ___ > 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] Viewer/CompositeViewer inconsistency?
Maybe I am missing something or not quite understanding what you are saying??? _camera->getUpdateCallback() is false and getSceneData()->getNumChildrenRequiringUpdateTraversal() is 2. It would seem that I do not have an update callback. Would you mind telling me more about both of these methods so I can see what is causing what I am seeing, please? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43647#43647 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Hi Thomas, On Mon, Oct 31, 2011 at 3:46 PM, Thomas Lerman wrote: > Maybe I am missing something or not quite understanding what you are > saying??? _camera->getUpdateCallback() is false and > getSceneData()->getNumChildrenRequiringUpdateTraversal() is 2. It would seem > that I do not have an update callback. Would you mind telling me more about > both of these methods so I can see what is causing what I am seeing, please? The above code is two separate checks - one to see if the view's master camera has an update callback and needs calling, and a check to see if the view's scene graph requires traversing. If getNumChildrenRequiringUpdateTraversal()!=0 then the scene graph has update callbacks attached to it that need traversing. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Okay, I am beginning to understand. I am using a layer that is mostly between osg & my application. I do not believe I am doing any update callbacks directly, but could be wrong. What are the methods that register the update callbacks so I can get to the bottom of this before got viewer types "break" what I am trying to do? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43649#43649 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Hi Thomas, If you don't actually need the functionality of the 3rd party's update callbacks you could remove them using a custom visitor. Or you could do as Robert suggests and write your own frame loop which ignores the call you're having problems with as you see fit. This option really would not take much effort and would let you customize exactly the behavior you want. I don't have any experience with your other issue, sorry. Tom -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43655#43655 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Thank you for the suggestions. The problem with writing my own frame loop (I already have done that) is that I run into another strange issue with the positioning of the graphics window. I am not familiar with using custom visitors. I have already spent too much time on this so may not have time to do research on it. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43671#43671 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Hi Thomas, On Tue, Nov 1, 2011 at 3:22 PM, Thomas Lerman wrote: > Thank you for the suggestions. The problem with writing my own frame loop (I > already have done that) is that I run into another strange issue with the > positioning of the graphics window. You have the access to the source the OSG, it's very easy to see how the Viewer::run() implementation works, and you can simply it further as you don't need to support all the options it has. It really is very straight forward. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Yeah, I have been looking at the source code quite a bit lately trying to get these things to work. I am not really sure what your are saying about the following method: Code: int Viewer::run() { if (!getCameraManipulator() && getCamera()->getAllowEventFocus()) { setCameraManipulator(new osgGA::TrackballManipulator()); } setReleaseContextAtEndOfFrameHint(false); return ViewerBase::run(); } -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43673#43673 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
On 11/01/2011 12:17 PM, Thomas Lerman wrote: Yeah, I have been looking at the source code quite a bit lately trying to get these things to work. I am not really sure what your are saying about the following method: Code: int Viewer::run() { if (!getCameraManipulator()&& getCamera()->getAllowEventFocus()) { setCameraManipulator(new osgGA::TrackballManipulator()); } setReleaseContextAtEndOfFrameHint(false); return ViewerBase::run(); } The last line is the key. Viewer::run() calls ViewerBase::run(). If you look at ViewerBase::run(), you'll see that it calls ViewerBase::frame() in a while (!_done) loop (along with some other ancillary stuff to handle on-demand rendering, run-to-frame control, etc). So, you could, in fact, write your own run loop like this: while (!viewer.done()) { viewer.frame(); } If you need more control than that (which it sounds like you do), you can look at ViewerBase::frame(). ViewerBase::frame() couldn't really be much simpler. Essentially, it is just: advance(); eventTraversal(); updateTraversal(); renderingTraversals(); You probably don't need to mess with the advance() step, or the renderingTraversals() call, so you can just look into the event and update passes to see where you might need to make some adjustments. Hopefully, this will help get you going in the right direction. --"J" ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Viewer/CompositeViewer inconsistency?
Thank you for your response. I have not been able to try much more on this as I already spent too much time on it. The layer that I am using between my app and osg has mentioned some lack of support, so I really do not want to spend more time on it until that is done. In any case, I am not using run() to handle the frame rendering. I am using Qt so am using either a QTimer or osgQt::setViewer() to handle it. As mentioned in another thread (no responses), it seems I am running into other inconsistencies. I may have to override checkNeedToDoFrame() to get what you suggested done. However, the other layer has indicated they need the update events for layout use. If I skip that, I wonder if I would run into other issues. Anyway, I will be waiting for their changes and hope to get the other inconsistencies ironed out. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43706#43706 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org