Hi YangXiao,

I think you should enough elements (equals to the size of the vertex
array) in the color array if using BIND_PER_VERTEX.

Wang Rui

2008/11/9 YangXiao <[EMAIL PROTECTED]>

> Thanks *Robert *
> *Now i error is in my *DrawableUpdateCallback
> **
> void  DrawableUpdateCallback::update(osg::NodeVisitor* nv, osg::Drawable*
> drawable)
> {
>   osg::Geometry* polyGeom  = dynamic_cast<osg::Geometry* >(drawable);
>   colors->push_back(osg::Vec4(1,0,0,1));  .
>   polyGeom->setColorArray(colors.get());
>   polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
>
> }
> This is ok.
> But when i use
> {
>
>   colors->push_back(osg::Vec4(1,0,0,1));
>   polyGeom->setColorArray(colors.get());
>   polyGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
> }
>
> There is runtime error.That is when i computer my new colors per vertex, I
> can not bind these new color array to my Drawable in DrawableUpdateCallback
>
> Best Regards.
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to