Hello all OSG users,

does anyone know how to use the Geometry::getColorIndices() method? I do not know how to work with the returned IndexArray - how to access and change the values.

My situation: Geometry uses generally one color and sometimes it's necessary to draw some primitiveSets by another color. So, I use BIND_PER_PRIMITIVE_SET, colorArray has one element and colorIndices is:

/*copied from OSG pyramid example, I do not know what last 2 params DataSize and DataType 4,4 mean :( */ osg::TemplateIndexArray<unsigned int, osg::Array::UIntArrayType,4,4> *colorIndices; colorIndices = new osg::TemplateIndexArray<unsigned int, osg::Array::UIntArrayType,4,4>;

....
(for every primitiveset) colorIndices.push_back(0);
...
.

This works fine, but now I want to change index in colorIndices array, but I do not know how to access the data in IndexArray* that is returned by Geometry::getColorIndices(). I tried to dynamic_cast to osg::UIntArray*, but such cast does not work. (like Vec4Array* works for getColorArray())

Any ideas how to access and work with the colorIndices array? Or is it necessary to remember the array as osg::TemplateIndexArray and use only setColorIndices - but if so, then why getColorIndices() exists?

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

Reply via email to