[osg-users] View Frutrum Culling

Paul Melis paul at science.uva.nl
Wed Jul 30 05:31:16 PDT 2008


Hi Hagen,

Kaiser, Hagen (CT) wrote:
> I did the following:
>
> class CullCallback : public osg::NodeCallback
> {
> public:
> 	bool isVisible;
> 	CullCallback():isVisible(false){}
>     virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
>     { 
>         traverse(node,nv);
> 		if (!((osgUtil::CullVisitor*) nv)->isCulled(*node))
> 			this->isVisible=true;
>     }
> };
>
> I installed this to every node where I want to know if its currently
> visible or not with setCullCallback
>
> Then I question somewhere else the flag like this:
>
> return ((CullCallback*)this->node->getCullCallback())->isVisible;
>
> Even if my camera is far away and facing somewhere, where nothing is
> visible.
> Everything is said to be visible.
>
> Please help me. I really don't get it.
>   
Could it be that the cull callback is only called for objects that are 
NOT culled, i.e. whose bounding spheres overlap with the frustum?

Paul



More information about the osg-users mailing list