We wrote a ReaderWriter for our proprietary format. Each of the loaded
models had AlphaFunc applied at the top node. And we had the same issue with
our scenes. When debuged it turned out that setAttribute( AlphaFunc ) was
not enough. There is associated ALPHA_TEST mode that shoud be ON as well.
Once we corrected our reader to use setAttributeAndModes everything got much
nicer...
Loaded scene hierarchy may change alpha func somewhere during traversal
before reaching leaves- osg::StateAttribute::OVERRIDE may become handy.
So I would recommend to try changing last line of your example to:
NewStateSet->setAttributeAndModes( TurnOnAlphaFuncbyDefault,
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE );
Hope this helps,
Cheers,
Wojtek Lewandowski
----- Original Message -----
From: "Marc Bernatchez" <[EMAIL PROTECTED]>
To: "OSG List" <[email protected]>
Sent: Friday, April 13, 2007 7:18 PM
Subject: Re: [osg-users] obscure state bug
"If users want AlphaFunc on by default for the opaque bin then they can
simply attached an osg::AlphaFunc to the topmost StateSet in the scene
graph and get back the old functionality."
Are we certain that this will work? I.e., that it will remain turned on in
the course of the traversal etc? I have tried to the best of my knowledge
but still see the visual artefacts. If my code is correct and this patch
is indeed correct, then what I am seeing is caused by something else. Here
is the current code I have:
osg::AlphaFunc *TurnOnAlphaFuncbyDefault = new osg::AlphaFunc();
osg::StateSet *NewStateSet = SceneGraphRoot->getOrCreateStateSet();
TurnOnAlphaFuncbyDefault->setFunction(osg::AlphaFunc::GREATER,0.0f);
NewStateSet->setAttribute(TurnOnAlphaFuncbyDefault,
osg::StateAttribute::ON);
Could you provide the exact code we need to revert back to the old
behavior in case the above is still incorrect?
Thanks for your help
--
=====================================
Marc Bernatchez
Candidat au Ph.D.
Ecole Polytechnique de Montreal
Montreal, QC, CANADA
=====================================
Virtual Reality web site, VResources:
http://vresources.org
=====================================
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
-------------------------------------------------------------
This mail was scanned by BitDefender
For more informations please visit http://www.bitdefender.com
-------------------------------------------------------------
-------------------------------------------------------------
This mail was scanned by BitDefender
For more informations please visit http://www.bitdefender.com
-------------------------------------------------------------
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/