Hi Kuba, I have just reviewed the code and I you are correct, adding if (_useVertexAttributeAlias) would be appropriate. I've added this and also added an if (_useModelViewAndProjectionUniforms) for the appropriate block. I've checked this fix into svn/trunk and OSG-3.2 branch.
Could you try it out? Robert. On 12 June 2014 15:29, Jakub Stępień <[email protected]> wrote: > Hi, > > While working with a pretty basic osg-based app I noticed that shader code > modification related vertex attribute aliasing (e.g. renaming from gl_Normal > to osg_Normal and then treating it as a generic vertex attribute) is active > if State::setUseModelViewAndProjectionUniforms(true) is called without much > regard to State::setUseVertexAttributeAliasing(false). > > Aside from being a bit counter-intuitive, it led (in my case) to rendering > issues since the shaders modified by osg contain custom attributes like > osg_Normal but osg internally keeps using things like glNormalPointer(..) to > provide the vertex information because of > setUseVertexAttributeAliasing(false). > > Issues vanish if both setUseModelViewAndProjectionUniforms(..) and > setUseVertexAttributeAliasing(..) set true (or false, obviously). > > The fix for me was pretty simple: I needed to surround the code responsible > for aliasing-related shader source alteration in > State::convertVertexShaderSourceToOsgBuiltIns(..) with a single if statement, > i.e.: > > > Code: > 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); > 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); > } > } > > > > Is my understanding of how setUseVertexAttributeAliasing(..) should work > correct? Is the above modification actually a fix or am I missing the point? > > Thanks, > Kuba[/code] > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59716#59716 > > > > > > _______________________________________________ > 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

