[osg-users] cullcallback and visitor ?

Robert Osfield robert.osfield at gmail.com
Mon Sep 29 07:29:59 PDT 2008


Hi Vincent,

There isn't really any much of clue about what might be wrong from
your email, so you are probably going to have rely on your own skills
to track down what you've done wrong.   The only hint I got from you
email was mention of a out of memory, which could suggest many things
including perhaps that the stack has been filled by a never ending
loop.  This is all your code we are talking about here so you the only
person in a position to debug it.

Robert.

On Mon, Sep 29, 2008 at 2:52 PM, Vincent Bourdier
<vincent.bourdier at gmail.com> wrote:
> Hi
>
> I make a little UP because I go now a strange problem :
>
> My Cullcallback seem to engender some other problems in my application. When
> I put it, the application can crash or freeze, pretending sometimes "not
> enough memory" (false, I've checked) or some other error messages with no
> relation with that. I suppose my cull callback is not good and randomly
> engender unstable states in the application...
>
> This is what I do, to check visible elements or not :
>
> Callback :
>
>> tileVisibleCallback::tileVisibleCallback(Tile* tile)
>>     : osg::NodeCallback(){
>>     _tile = tile;
>> };
>>
>> void tileVisibleCallback::operator()(osg::Node* node, osg::NodeVisitor*
>> nv){
>>
>>     if(!_tile.valid()){
>>         osg::notify(osg::WARN)<<"Tile callback error : tile not
>> recognized!\n";
>>         return;
>>     }
>>
>>     //This method is called so the tile is visible
>>     //    Its name is added to the visible Tile list.
>>     _tile->_stack->_cullList.push_back(_tile->getName());
>>
>>
>>     traverse(node, nv);
>> };
>
>
>
> and the Set :
>
>> osg::ref_ptr<tileVisibleCallback> tvc = new tileVisibleCallback(this);
>>     if(_mainChild->getCullCallback())
>>         _mainChild->getCullCallback()->setNestedCallback(tvc.get());
>>     else
>>         _mainChild->setCullCallback(tvc.get());
>
> Do you see something not clear ? unstable ? what can engender problems ?
>
> Thanks a lot.
>
> Regards,
> Vincent
>
> 2008/9/26 Vincent Bourdier <vincent.bourdier at gmail.com>
>>
>> Hi,
>>
>> I found an other solution using a vector to store the visible elements and
>> clearing this list each render loop. I is the more simple solution I think.
>>
>> thanks for your help.
>> Regards,
>>    Vincent.
>>
>> 2008/9/26 Ulrich Hertlein <u.hertlein at sandbox.de>
>>>
>>> Hi Vincent,
>>>
>>> Vincent Bourdier wrote:
>>> >> Vincent Bourdier wrote:
>>> >>> If if do a nodevisitior, I've the problem that the operator() takes a
>>> >>> nodevisitor in parameter and so I can't obtain the cull state with
>>> >>> that.
>>> >>> (method isCulled() not aviable from a node visitor)
>>> >> The way I understood Robert, the fact that your operator() is called
>>> >> means
>>> >> the node in
>>> >> question is *not* culled so you could simple set your _isCulled=true.
>>> >>  And
>>> >> don't forget to call traverse().
>>> >
>>> > Ok, this is a simple and good way to have the result, but not
>>> > sufficient :
>>> > cull = true when operator() is called, but if the operator is not
>>> > called,
>>> > cull still = true and will never be false...
>>>
>>> Yes it will never be reset by the cull traversal so you have to do that
>>> yourself e.g. just
>>> before cull or maybe after you've read the cull state from your class.
>>>
>>> Cheers,
>>> /ulrich
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list