Hi Linda,
int num = vertex->getNumElements();
What is vertex? Is it a Vec3Array? Did you check the return value of vertex->getNumElements() ? I think for a Vec3Array it will return 3 all the time - it's the number of elements per item in the array. To get the number of items - the number of Vec3s or the number of vertices - you should call size() (as for an std::vector, since osg::TemplateArray inherits osg::MixinVector which exposes an std::vector interface). But I'm not sure about getNumElements(), I generally just use size() so I don't remember what it's meant to return actually.
Also, to make your changes visible, if your geometry has display lists enabled, you'll need to call geo->dirtyDisplayList(). If you're updating the color array (or any array) very often, like once per frame, consider turning off display lists, as their generation is a bit slow and if it happens too often (triggered by dirtyDisplayList()) it will really slow down your frame rate. Display lists are good for when the geometry is static and can be reused for many frames.
Hope this helps, J-S -- ______________________________________________________ Jean-Sebastien Guay [email protected] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

