[osg-users] [Question about StateSet.cpp] truncated attribute override value?
Julien Valentin
julienvalentin51 at gmail.com
Mon Sep 21 04:30:43 PDT 2015
Hello,
Ive encountered repeated problems with the OVERRIDE flag value on StateAttribute (seams not taken into account).
And as I developped my own runtime environment, I have to debug my own code before to sure. After that i will debug osg and write back my investigations result here.
Cheers.
robertosfield wrote:
> Hi Julien,
>
>
> I don't recall the why and wherefores of this particular bit of code in StateSet.cpp (i.e. line 1662 and associated code) but it's a loooong time since I wrote it ;-)
>
>
> My best guess right now is that the ON/OFF for StateAttribute doesn't affect anything, a StateAttribute isn't like a GL Mode that can be switched on/off. All you can do with a StateAttribute is call it or not, and if you don't want to call it you remove it from the StateSet. This means all StateAttribute attached to StateSet are implicitly ON if you wanted to think it about a mode but in the end it's not a mode so it's probably best not to try and treat it like one.
>
>
> In the case of the StateSet API we reuse the OverrideValue as a bit mask so it's used for the mode ON/OFF and the OVERRIDE and PROTECTED switches. The ON/OFF is only relevant to store for the Mode which StateAttribute and Uniform's only the OVERRIDE and PROTECTED are significant to store.
>
>
> Does this make sense?
>
> Robert.
>
>
>
>
>
>
>
> On 9 September 2015 at 18:45, Julien Valentin < ()> wrote:
>
> > Hi,
> > Iwould like to introspect StateSet in order to know which override value is activated for a particular stateset.
> > I parse AttributeList for this
> >
> > Code:
> > for( osg::StateSet::AttributeList::const_iterator it=ss->getAttributeList().begin();it!=ss->getAttributeList().end() ; it++)
> > {
> > if((*it).second.first ==stateattribute)
> > {
> > if( (*it).second.second & osg::StateAttribute::ON)
> > return(1);
> > else return(0);
> > }
> >
> >
> >
> > but according to StateSet.cpp l.1662
> >
> > Code:
> > attributeList[attribute->getTypeMemberPair()] = RefAttributePair(attribute,value&(StateAttribute::OVERRIDE|StateAttribute::PROTECTED));
> >
> >
> >
> > the ON OFF bit is removed from the given user value. So I can't determine if an osg::Attribute is ON or OFF but only if it's OVERRIDE or PROTECTED
> > I would like to know if there's a known reason behind this logic & and further if you know a mean to retrieve the ON/OFF bit.
> >
> > Thank you!
> >
> > Cheers,
> > Julien
> >
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=65081#65081 (http://forum.openscenegraph.org/viewtopic.php?p=65081#65081)
> >
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> >
>
>
> ------------------
> Post generated by Mail2Forum
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65167#65167
More information about the osg-users
mailing list