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

Reply via email to