diff --git a/src/osg/State.cpp b/src/osg/State.cpp index e91af6adb..354275162 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -884,9 +884,9 @@ void State::resetVertexAttributeAlias(bool compactAliasing, unsigned int numText if (compactAliasing) { unsigned int slot = 0; - setUpVertexAttribAlias(_vertexAlias, slot++, "gl_Vertex","osg_Vertex","attribute vec4 "); - setUpVertexAttribAlias(_normalAlias, slot++, "gl_Normal","osg_Normal","attribute vec3 "); - setUpVertexAttribAlias(_colorAlias, slot++, "gl_Color","osg_Color","attribute vec4 "); + setUpVertexAttribAlias(_vertexAlias, slot++, "gl_Vertex","osg_Vertex","vec4 "); + setUpVertexAttribAlias(_normalAlias, slot++, "gl_Normal","osg_Normal","vec3 "); + setUpVertexAttribAlias(_colorAlias, slot++, "gl_Color","osg_Color","vec4 "); _texCoordAliasList.resize(numTextureUnits); for(unsigned int i=0; i<_texCoordAliasList.size(); i++) @@ -896,20 +896,20 @@ void State::resetVertexAttributeAlias(bool compactAliasing, unsigned int numText gl_MultiTexCoord<<"gl_MultiTexCoord"<= 130) attributeQualifier = "in "; // found the string, now find the next linefeed and set the insertion point after it. declPos = source.find( '\n', declPos ); declPos = declPos != std::string::npos ? declPos+1 : source.length(); @@ -1477,23 +1485,23 @@ bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const State_Utils::replace(source, "ftransform()", "gl_ModelViewProjectionMatrix * gl_Vertex"); // replace built in uniform - State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewMatrix", "osg_ModelViewMatrix", "uniform mat4 "); - State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewProjectionMatrix", "osg_ModelViewProjectionMatrix", "uniform mat4 "); - State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ProjectionMatrix", "osg_ProjectionMatrix", "uniform mat4 "); - State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_NormalMatrix", "osg_NormalMatrix", "uniform mat3 "); + State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewMatrix", "osg_ModelViewMatrix", "uniform ", "mat4 "); + State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewProjectionMatrix", "osg_ModelViewProjectionMatrix", "uniform ", "mat4 "); + State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ProjectionMatrix", "osg_ProjectionMatrix", "uniform ", "mat4 "); + State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_NormalMatrix", "osg_NormalMatrix", "uniform ", "mat3 "); } if (_useVertexAttributeAliasing) { - State_Utils::replaceAndInsertDeclaration(source, declPos, _vertexAlias._glName, _vertexAlias._osgName, _vertexAlias._declaration); - State_Utils::replaceAndInsertDeclaration(source, declPos, _normalAlias._glName, _normalAlias._osgName, _normalAlias._declaration); - State_Utils::replaceAndInsertDeclaration(source, declPos, _colorAlias._glName, _colorAlias._osgName, _colorAlias._declaration); - State_Utils::replaceAndInsertDeclaration(source, declPos, _secondaryColorAlias._glName, _secondaryColorAlias._osgName, _secondaryColorAlias._declaration); - State_Utils::replaceAndInsertDeclaration(source, declPos, _fogCoordAlias._glName, _fogCoordAlias._osgName, _fogCoordAlias._declaration); + State_Utils::replaceAndInsertDeclaration(source, declPos, _vertexAlias._glName, _vertexAlias._osgName, attributeQualifier, _vertexAlias._declaration); + State_Utils::replaceAndInsertDeclaration(source, declPos, _normalAlias._glName, _normalAlias._osgName, attributeQualifier, _normalAlias._declaration); + State_Utils::replaceAndInsertDeclaration(source, declPos, _colorAlias._glName, _colorAlias._osgName, attributeQualifier, _colorAlias._declaration); + State_Utils::replaceAndInsertDeclaration(source, declPos, _secondaryColorAlias._glName, _secondaryColorAlias._osgName, attributeQualifier, _secondaryColorAlias._declaration); + State_Utils::replaceAndInsertDeclaration(source, declPos, _fogCoordAlias._glName, _fogCoordAlias._osgName, attributeQualifier, _fogCoordAlias._declaration); for (size_t i=0; i<_texCoordAliasList.size(); i++) { const VertexAttribAlias& texCoordAlias = _texCoordAliasList[i]; - State_Utils::replaceAndInsertDeclaration(source, declPos, texCoordAlias._glName, texCoordAlias._osgName, texCoordAlias._declaration); + State_Utils::replaceAndInsertDeclaration(source, declPos, texCoordAlias._glName, texCoordAlias._osgName, attributeQualifier, texCoordAlias._declaration); } } @@ -1725,7 +1733,6 @@ void State::print(std::ostream& fout) const #if 0 GraphicsContext* _graphicsContext; unsigned int _contextID; - bool _shaderCompositionEnabled; bool _shaderCompositionDirty; osg::ref_ptr _shaderComposer;