|
发表于 2012-8-2 00:24:04
|
显示全部楼层
本帖最后由 int_178 于 2012-8-2 00:24 编辑
array 发表于 2009-12-25 09:35
也可以用clear()清除颜色数组的数据。不过其实直接设置setColorBinding(BIND_OFF)是最好的,这样还可以在需 ... - /**********************************************************
- *Write by FlySky
- *zzuxp@163.com http://www.OsgChina.org
- **********************************************************/
- //.......................之前内容和本书源码的基本几何体绘制(Geometry)示例例子完全一样
- //创建颜色数组
- osg::Vec4Array* vc = new osg::Vec4Array();
- //添加数据
- vc->push_back(osg::Vec4(1.0f,0.0f,0.0f,1.0f));
- vc->push_back(osg::Vec4(0.0f,1.0f,0.0f,1.0f));
- vc->push_back(osg::Vec4(0.0f,0.0f,1.0f,1.0f));
- vc->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
- //设置颜色数组
- geom->setColorArray(vc);
- //设置颜色的绑定方式为不绑定
- geom->setColorBinding(osg::Geometry::BIND_OFF);
- //.......................之后也完全一样
- }
- }
复制代码 但是颜色依然存在?为什么? |
|