Hello Carsten, I followed your proposal and implemented the following to methods, which are called as expected...
Action::ResultE onEnterGeometry( CNodePtr& pNode, Action * action ) { RenderAction *ra = dynamic_cast<RenderAction *>(action); MaterialDrawable *pMD = dynamic_cast<MaterialDrawable *>(pNode.getCPtr()); Material::DrawFunctor func; func = osgTypedMethodFunctor1ObjPtr(pMD, &MaterialDrawable::drawPrimitives); // retrieve id material osg::ChunkMaterialPtr m = SelectionHelper::getInstance()->getIDMaterial(osg::getContainerId(pNode)); ra->dropFunctor(func, m.getCPtr()); if(ra->pushVisibility()) { if(ra->selectVisibles() == 0) { ra->popVisibility(); return Action::Skip; } } return Action::Continue; } Action::ResultE onLeaveGeometry( CNodePtr&, Action * action ) { RenderAction *ra = dynamic_cast<RenderAction *>(action); ra->popVisibility(); return Action::Continue; } The problem is, my id material seems to be ignored (the result is a standard rendering). This seems to be caused by RenderAction::dropFunctor as this method, first looks at an internal material and afterwards checks the material that I pass to that function. if(getMaterial() != NULL) { pMat = getMaterial(); } else if(mat != NULL) { pMat = mat; } else { return; } Any ideas how this can be avoided without changing OpenSG1.8 source? Thanks, Michael -------- Original-Nachricht -------- > Datum: Mon, 15 Nov 2010 09:23:22 -0600 > Von: Carsten Neumann <carsten_neum...@gmx.net> > An: opensg-users@lists.sourceforge.net > Betreff: Re: [Opensg-users] ID Buffer Selection > Hello Michael, > > On 11/15/2010 08:35 AM, Michael Raab wrote: > > I'm interested in doing scene selection using id buffer information as > we have very large scenes. I had a look at the appropriate OpenSG1.8 > tutorial. Adding a switch material to each materialgroup isn't solution for > us. > > why? > > > Do you have an idea about alternative implementation strategies, e.g. > assigning some attachments and derive render action? > > you can change the callback called by the RenderAction for Geometry on a > per RenderAction instance basis. So you could create two RenderAction > objects and for one you use registerEnter()/registerLeave() to change > the Geometry callback to something that does the id-buffer rendering > instead of using the normal material. > More specifically: Geometry registers > MaterialDrawable::renderActionEnterHandler as its default handler, > create a function > > OSG::Action::ResultE > idBufferRenderEnter(OSG::CNodePtr &node, OSG::Action *action) > { > // basically the same as MaterialDrawable::renderActionHandler, > // but don't use the MaterialDrawable's material, > // instead get the id buffer material from some attachment, or so > } > > and register it with a RenderAction instance, similar for the leave > handler. > > Cheers, > Carsten > > ------------------------------------------------------------------------------ > Centralized Desktop Delivery: Dell and VMware Reference Architecture > Simplifying enterprise desktop deployment and management using > Dell EqualLogic storage and VMware View: A highly scalable, end-to-end > client virtualization framework. Read more! > http://p.sf.net/sfu/dell-eql-dev2dev > _______________________________________________ > Opensg-users mailing list > Opensg-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensg-users -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users