Hi,
I figured out that I need to set the normal array and bind it to each primitive
set.
Can anyone tell me why I cannot get the opacity of the volume (Geometry) that
I've drawn to change? Here's how I set the color:
////////////////////////////////////////////////////////////////////
//Set the color
float opacityPercentage(20.0);
osg::Vec4 color(0.75, 0.75, 0.75, (opacityPercentage / 100.0)); //Light grey
long lNumFaces = lNumFrontFacePoints + 2;
osg::Vec4Array* colors = new osg::Vec4Array;
for(long lFace = 0; lFace < lNumFaces ; ++lFace)
colors->push_back(color);
osg::TemplateIndexArray <unsigned int, osg::Array::UIntArrayType,6,4>
*colorIndexArray;
colorIndexArray = new osg::TemplateIndexArray<unsigned int,
osg::Array::UIntArrayType,6,4>;
for(long lFace = 0; lFace < lNumFaces; ++lFace)
colorIndexArray->push_back(lFace);
//Assign the color to each of the sides
geometry->setColorArray(colors);
geometry->setColorIndices(colorIndexArray);
geometry->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
////////////////////////////////////////////////////////////////////
No matter what value I enter for opacityPercentage, from zero to 100, the
volume ends up looking the same.
I forgot to mention in my previous post that I'm running osg version 2.6.0.
Thank you!
Cheers,
Evan
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15322#15322
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org