From David Callu, added support for glVertexAttribLPointer and glVertexAttribIPointer, utilized via osg::Array::setPreserveDataType(true);

This commit is contained in:
Robert Osfield
2013-06-28 10:51:22 +00:00
parent 4fd6566e00
commit db1f2c5eb1
3 changed files with 132 additions and 4 deletions

View File

@@ -752,14 +752,24 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
}
}
if( handleVertexAttributes )
if ( handleVertexAttributes )
{
for(unsigned int index = 0; index < _vertexAttribList.size(); ++index )
for(unsigned int index = 0; index < _vertexAttribList.size(); ++index)
{
const Array* array = _vertexAttribList[index].get();
if(array && array->getBinding()==osg::Array::BIND_PER_VERTEX)
if (array && array->getBinding()==osg::Array::BIND_PER_VERTEX)
{
state.setVertexAttribPointer( index, array );
if (array->getPreserveDataType())
{
GLenum dataType = array->getDataType();
if (dataType==GL_FLOAT) state.setVertexAttribPointer( index, array );
else if (dataType==GL_DOUBLE) state.setVertexAttribLPointer( index, array );
else state.setVertexAttribIPointer( index, array );
}
else
{
state.setVertexAttribPointer( index, array );
}
}
}
}