Hi David,
On 27 June 2013 17:12, David Callu <[email protected]> wrote:
> Here the VertexAttributePointer submission (VertexAttribPointer.txz) based
> on last SVN trunk
I have now merged the changes for the glVertexAttribLPointer and
glVertexAttribIPointer, when merging I tweaked the Geometry.cpp
changes to be a bit easier to read:
Index: src/osg/Geometry.cpp
===================================================================
--- src/osg/Geometry.cpp (revision 13583)
+++ src/osg/Geometry.cpp (working copy)
@@ -752,14 +752,24 @@
}
}
- 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 );
+ }
}
}
}
While it's taken a little while for us to get here I'm pretty happy
with how things have ended up, it feels pretty clean.
The only thing missing now is the serializer support. For this I'm
thinking we need to change the way the Array's are serialized so that
the various parameters now in osg::Array are stored within the rest of
osg::Array serializers rather than outside in osg::Geometry
serializers. Such a change will need to be protected by version
checks though as we'll need to maintain backwards compatibility.
I have plenty of other submissions to review so I'll get on to these
rather than attempt to tie up the serializer work right now.
Thanks for you patience on this one,
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org