diff --git a/src/osg/Program.cpp b/src/osg/Program.cpp index fa95bf15b..0bf89d02c 100644 --- a/src/osg/Program.cpp +++ b/src/osg/Program.cpp @@ -105,7 +105,23 @@ Program::Program() : Program::Program(const Program& rhs, const osg::CopyOp& copyop): osg::StateAttribute(rhs, copyop) { - osg::notify(osg::FATAL) << "how got here?" << std::endl; + for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex ) + { + addShader( new osg::Shader( *rhs.getShader( shaderIndex ), copyop ) ); + } + + const osg::Program::AttribBindingList &abl = rhs.getAttribBindingList(); + for( osg::Program::AttribBindingList::const_iterator attribute = abl.begin(); attribute != abl.end(); ++attribute ) + { + addBindAttribLocation( attribute->first, attribute->second ); + } + + const osg::Program::FragDataBindingList &fdl = rhs.getFragDataBindingList(); + for( osg::Program::FragDataBindingList::const_iterator fragdata = fdl.begin(); fragdata != fdl.end(); ++fragdata ) + { + addBindFragDataLocation( fragdata->first, fragdata->second ); + } + _geometryVerticesOut = rhs._geometryVerticesOut; _geometryInputType = rhs._geometryInputType; _geometryOutputType = rhs._geometryOutputType; diff --git a/src/osg/StateSet.cpp b/src/osg/StateSet.cpp index 466506fab..2fcaa2dce 100644 --- a/src/osg/StateSet.cpp +++ b/src/osg/StateSet.cpp @@ -425,8 +425,10 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const { if (lhs_uniform_itr->firstfirst) return -1; else if (rhs_uniform_itr->firstfirst) return 1; - if (lhs_uniform_itr->secondsecond) return -1; - else if (rhs_uniform_itr->secondsecond) return 1; + if (*lhs_uniform_itr->second.first<*rhs_uniform_itr->second.first) return -1; + else if (*rhs_uniform_itr->second.first<*lhs_uniform_itr->second.first) return 1; + if (lhs_uniform_itr->second.secondsecond.second) return -1; + else if (rhs_uniform_itr->second.secondsecond.second) return 1; ++lhs_uniform_itr; ++rhs_uniform_itr; }