Hi Carsten,
I tried it your way. I used MaterialGroup::renderEnter/Leave as draft for my
implementation.
Action::ResultE onEnterMaterialGroup( CNodePtr& pNode, Action * action )
{
RenderAction *ra = dynamic_cast<RenderAction *>(action);
MaterialGroupPtr mg = MaterialGroupPtr::dcast(pNode);
Action::ResultE r = mg->renderEnter(action);
osg::ChunkMaterialPtr m =
SelectionHelper::getInstance()->getIDMaterial(osg::getContainerId(pNode));
ra->setMaterial(m.getCPtr(), action->getActNode());
return r;
}
Action::ResultE onLeaveMaterialGroup( CNodePtr& pNode, Action * action )
{
RenderAction *ra = dynamic_cast<RenderAction *>(action);
MaterialGroupPtr mg = MaterialGroupPtr::dcast(pNode);
return mg->renderLeave(action);
}
The problem is
mg->renderEnter(action) and
mg->renderLeave(action)
are protected. Ideas?
Thanks,
Michael
-------- Original-Nachricht --------
> Datum: Tue, 16 Nov 2010 08:59:42 -0600
> Von: Carsten Neumann <[email protected]>
> An: [email protected]
> Betreff: Re: [Opensg-users] ID Buffer Selection
> Hello Michael,
>
> On 11/16/2010 08:53 AM, Michael Raab wrote:
> > I followed your proposal and implemented the following to methods, which
> are called as expected...
> [SNIP]
> > 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?
>
> hm, this is caused by MaterialGroups. They set the material in the
> RenderAction which then takes precedence over any object's material.
>
> Registering Group::renderEnter/Group::enterLeave as the callbacks for
> type MaterialGroup with your idbuffer RenderAction should get you around
> that.
>
> Cheers,
> Carsten
>
> ------------------------------------------------------------------------------
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
--
GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users