[osg-users] Fast VectorArray inizialization.

Robert Osfield robert.osfield at gmail.com
Fri Apr 1 02:11:18 PDT 2011


Hi Giulio,

All osg::Vec*Array() are subclassed from the std::vector<> so you have
all the usual std::vector<> methods available.  For examples of
different ways of initialization the array see the osggeometry
example.

Robert.

On Fri, Apr 1, 2011 at 9:57 AM, Giulio De Vecchi
<giulio.devecchi at libero.it> wrote:
> Hi all,
> I have some code like this:
>
> float coordinates[]
> ...
> ... an external source fill the previous array ...
> ...
> osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array();
> for (int i = 0; i < 3 * numPoints; i += 3)
> {
>        float x = coordinates[i];
>        float y = coordinates[i+1];
>        float z = coordinates[i+2];
>        vertices->push_back(osg::Vec3(x, y, z));
> }
> modelGeometry->setVertexArray(vertices);
>
> I'd rather do something like this:
>
> modelGeometry->setVertexArray_FromCArray(coordinates);
>
> Is it possible? How?
>
> ---
>
> Best regards,
> Giulio
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=38157#38157
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list