Hi Sebastian,

On 26 June 2013 10:03, Sebastian Messerschmidt
<[email protected]> wrote:
> I'm currently checking the new 3.1.8 release with much appreciated new
> osg::Geometry implementation.
>
> There are some question comming up however:
> I'm trying to adapt some of the osg-plugins to the new Geometry, for
> instance the openflight implementation.
>
> There are calls like those:
>
>  geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
>
> If I understood everything correctly, those calls are to be replaced with:
>
> geometry->getColorArray().setBinding(osg::Array::BIND_PER_VERTEX)
>
> Is this correct?
> Those binding are set afterwards, due to the openflight structure, so I
> guess this is the way to go.
> If so, I'd be happy to fix the openflight plugin.

For OSG-3.2 I'll maintain the Geometry::set*Binding() methods, but
once 3.2 is out I'll move these methods into deprecated_osg::Geometry,
so for the current release cycle making this change won't be critical.
 I'd like it to happen as users read OSG code as template of how to
write their own applications, but such changes will be a low priority.

W.r.t preferred usage, you can now do:

 osg::Vec4Array* colors = new osg::Vec4Array(osg::Array::BIND_PER_VERTEX);
 geometry->setColorArray(colors);

Or:

osg::Vec4Array* colors = new osg::Vec4Array(osg::Array::BIND_PER_VERTEX);
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);

The later would be the quickest way to convert existing code as you'd
just combine the original two setColorArray(..); setColorBinding(..)
into a single setColorArray() call.

Or.. you could do the
geometry->getColorArray()->setBinding(osg::Array::BIND_PER_VERTEX) as
you suggested as this is perfectly legal, but a little long winded and
requires that getColorArray() has already been assigned.

--

If I have some time spare I may move the
Geometry::AttributeBinding/set*Binding() code into
deprecated_osg::Geometry and attempt a build of the OSG.  Lots of code
will break and need moving across to the new scheme so I'm wary of
this.  I may just tackle the core libraries and examples, others are
welcome to pitch in with this work.  The result should be more
streamlined code and more compatible with future rev of the OSG.

Cheers,
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to