[osg-users] getColorIndices usage
tomas.hnilica at webstep.net
Wed Jul 2 00:20:30 PDT 2008
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
/*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 = new osg::TemplateIndexArray<unsigned int,
(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
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?
More information about the osg-users