may be it depends on driver , but setUseDisplayList(false); works very strange!!!
if I set it to false I get one direct line without color information and all
new vertices is drawn in (0,0,0).
Here my code and 2 screens differs only in one : in second screen line
linesGeom->setUseDisplayList(false); is commented
Any Idea?
CODE
-----------------------------------------
class TglLine
{
public:
int ID;
TglLine(float X,float Y,float Z, QColor color);
~TglLine(void);
osg::Geode* Geode;
void addNode(float X,float Y,float Z, QColor color);
private:
osg::ref_ptr<osg::DrawArrays> drawArrayLines ;
osg::ref_ptr<osg::Vec3Array> vertexData ;
osg::ref_ptr<osg::Vec4Array> colors ;
osg::ref_ptr<osg::Geometry> linesGeom ;
};
//CONSTRUCTOR
TglLine::TglLine(float X,float Y,float Z, QColor color)
{
//ALLOCATE MEMORY
drawArrayLines = new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP);
vertexData = new osg::Vec3Array;
linesGeom = new osg::Geometry();
Geode =new osg::Geode;
colors = new osg::Vec4Array;
vertexData->push_back(osg::Vec3(X,Y,Z));
drawArrayLines->setFirst(0);
drawArrayLines->setCount(vertexData->size());
linesGeom->addPrimitiveSet(drawArrayLines.get());
linesGeom->setVertexArray(vertexData.get());
linesGeom->setColorArray(colors);
linesGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
// linesGeom->setUseDisplayList(false);
Geode->addDrawable(linesGeom.get());
}
// ADD NODE
void TglLine::addNode(float X,float Y,float Z, QColor color){
vertexData->push_back(osg::Vec3(X,Y,Z));
colors->push_back(osg::Vec4(color.red(),color.green(),color.blue(),
color.alphaF()));
drawArrayLines->setFirst(0);
int i =vertexData->size();
drawArrayLines->setCount(i);
linesGeom->dirtyBound();
}
//HERE my call
TglLine *test_line=new TglLine::TglLine(0,0,0,QColor(255,255,255,255));
root->addChild(test_line->Geode);
QColor col= QColor(255,0,255,100);
test_line->addNode(0,0,5000, col);
test_line->addNode(10000, 10000, 10000, col);
test_line->addNode(-10000, -10000, -10000, col);
test_line->addNode(-10000, 300, -10000, col);
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=10366#10366
<<attachment: 182544-1.jpg>>
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

