Hi,
I am running the example code for 'basic geometry' of the tutorials. It seems
that whatever I tried, the colors of the geometry do not show up. Everything
just turns to be grey. It is frustrating that even I do not make any changes of
the example codes at all, the colors still do not work. Could anyone give me a
hint of the problem on this?
Here are the codes for coloring:
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f) ); //index 0 red
colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f) ); //index 1 green
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f) ); //index 2 blue
colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f) ); //index 3 white
osg::TemplateIndexArray
<unsigned int, osg::Array::UIntArrayType,4,4> *colorIndexArray;
colorIndexArray =
new osg::TemplateIndexArray<unsigned int, osg::Array::UIntArrayType,4,4>;
colorIndexArray->push_back(0);
colorIndexArray->push_back(1);
colorIndexArray->push_back(2);
colorIndexArray->push_back(3);
colorIndexArray->push_back(0);
pyramidGeometry->setColorArray(colors);
pyramidGeometry->setColorIndices(colorIndexArray);
pyramidGeometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
...
Thank you!
Cheers,
Lelin
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12933#12933
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org