On Tue, Jul 6, 2010 at 11:14 PM, Cory Riddell <c...@codeware.com> wrote:
> Robert, > > Thanks for the quick reply. > > If I understand the NodeMask and CullMask, these would cull entire > nodes, not individual osg::Drawable instances, correct? > Yes, but you can store one Drawable per Geode node, or perhaps group of these Drawables that can be turned off into a single Geode. > > For example, I have geode's that contain a text label as one of their > drawables. I thought about using a switch node to toggle the text on and > off, but that seemed a bit heavy compared to a callback. With my draw > callback, I can easily turn labels on or off for the entire graph. The > penalty is that those drawables cannot use display lists. > > That could be a stiff penalty. Using a node mask also saves OSG work in the cull and draw phases of the rendering loop. Tim > Cory > > On 7/6/2010 3:16 PM, Robert Osfield wrote: > > Hi Cory, > > > > This is expected behaviour as the draw callback is nested within the > > code that sets up display lists, so once the display list is created > > it'll not call the callback again. If you disable the use of display > > lists via drawable->setUseDisplayLists(false); then your callback will > > be called on every frame. > > > > Another approach you could take to switching on/off various subgraphs > > is to use a combination of NodeMask and CullMask. Have a look at the > > osgstereoimage example for inspiration on this approach. > > > > Robert. > > > > On Tue, Jul 6, 2010 at 8:19 PM, Cory Riddell <c...@codeware.com> wrote: > > > >> I have a very simple draw callback defined that uses a bool to decide if > >> the drawable should be drawn. The body of the callback's > >> drawImplementation() looks like: > >> > >> if (m_enable) > >> { > >> drawable->drawImplementation(renderInfo); > >> } > >> > >> I have drawables scattered all over my scene that use the same instance > >> of this callback. By doing this, I'm able to toggle all of those > >> drawables on or off by setting a single bool. > >> > >> This only seems to work though if the drawable has display lists > >> disabled. My code to set the callback looks like: > >> > >> drawable->setUseDisplayList(false); > >> // callback is my shared callback instance > >> drawable->setDrawCallback(callback); > >> > >> Is this expected behaviour? If I understand this correctly, to use > >> display lists, I would have to tell each drawable to recompile > >> (dirtyDisplayList()) whenever I toggle my m_enable bool. Since the whole > >> point of my shared draw callback is to avoid traversing my graph, doing > >> so would defeat the purpose of my callback. So, do I understand this > >> correctly? > >> > >> It looks like display lists can prevent a draw callback from being > >> called. Is that right? > >> > >> Cory > >> > >> > >> > >> _______________________________________________ > >> 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 >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org