Hi All, I once again checked operator precedence to be sure. == operator has higher precedence than bitwise &. So it looks like parentheses are needed.
Cheers, Wojtek -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bob Kuehne Sent: Friday, October 03, 2008 10:10 PM To: OpenSceneGraph Users Subject: Re: [osg-users] osgPPU yeah, i had this warning (add parenthesis to disambiguate intention of the &) as well. so, i think you're saying the expected code is: if ( ( it->second.second & osg::StateAttribute::ON ) == osg::StateAttribute::ON ) b On Fri, Oct 3, 2008 at 4:07 PM, Adrian Egli OpenSceneGraph (3D) <[EMAIL PROTECTED]> wrote: > No problem, but append some parentheses to be sure that the compiler > understand well what you are doing or what you like to do > > adrian > > 2008/10/3 Art Tevs <[EMAIL PROTECTED]> >> >> Hi Adrian, >> >> >> I think it should. This is just a quick test if a program attribute is >> enabled. I haven't found a best solution for that, hence implemented it in >> this way. >> >> However I think the & operator is applied before == operator, which yields >> in the same operation as your first solution. It do just check if the ON >> attribute is present in the state attribute. However I agree, it is better >> to change that. I'll do this next. >> >> Cheers, >> art >> >> >> > Is the code doing what we want? >> > >> > // now apply all uniforms which are in the database >> > for (osg::StateSet::UniformList::const_iterator it = >> > mUniforms.begin(); >> > it != mUniforms.end(); it++) >> > { >> > if (it->second.second & >> > osg::StateAttribute::ON == >> > osg::StateAttribute::ON) >> > >> > lastAppliedProgram->apply(*(it->second.first)); >> > } >> > >> > we should use >> > if (* ( it->second.second & osg::StateAttribute::ON >> > )* == >> > osg::StateAttribute::ON) >> > >> > or >> > >> > if (it->second.second &* (osg::StateAttribute::ON == >> > osg::StateAttribute::ON)* ) >> > >> > or >> > if (it->second.second *&& >> > *osg::StateAttribute::ON == >> > osg::StateAttribute::ON ) >> > >> > >> > see @ >> > f:\dev\OpenSceneGraph\osgPPU\src\osgPPU\ShaderAttribute.cpp >> > at line 363 >> > >> > >> > -- >> > ******************************************** >> > Adrian Egli >> > _______________________________________________ >> > osg-users mailing list >> > [email protected] >> > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > -- > ******************************************** > Adrian Egli > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- bob kuehne founder and ceo - blue newt software www.blue-newt.com 734/834-2696 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

