Thanks Wang Rui I check color array size equal to vertex array size.
I means can i update Drawable color array in DrawableUpdateCallback?
Wang Rui <[EMAIL PROTECTED]> 写道:
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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
---------------------------------
雅虎邮箱,您的终生邮箱!_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org