diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 87f7b3579..0ee645007 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -1265,11 +1265,11 @@ namespace State_Utils return replacedStr; } - void replaceAndInsertDeclaration(std::string& source, const std::string& originalStr, const std::string& newStr, const std::string& declarationPrefix) + void replaceAndInsertDeclaration(std::string& source, std::string::size_type declPos, const std::string& originalStr, const std::string& newStr, const std::string& declarationPrefix) { if (replace(source, originalStr, newStr)) { - source.insert(0, declarationPrefix + newStr + std::string(";\n")); + source.insert(declPos, declarationPrefix + newStr + std::string(";\n")); } } } @@ -1279,32 +1279,46 @@ bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const OSG_NOTICE<<"State::convertShaderSourceToOsgBuiltIns()"<