[osg-users] Fast VectorArray inizialization.

Giulio De Vecchi giulio.devecchi at libero.it
Fri Apr 1 01:57:04 PDT 2011


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








More information about the osg-users mailing list