Hi Pietro,

You need to pass in the number of vertices to draw to DrawArrays.

I'd also recommend not using per vertex indices as this force the OSG
onto OpenGL slow path, its best to use DrawElementsUInt/UShort
instead.

Robert.

On 4/23/07, Pietro Incardona <[EMAIL PROTECTED]> wrote:
Hi all I am trying to draw a line starting from a vertex array and an index
array

I have tryed a code like this:



....................

Lines.index->push_back(n1);
Lines.index->push_back(n2);
Lines.colors->push_back(osg::Vec4d(1, 1, 0, 1));

Lines.EncLines->setVertexArray(Points.Points.get());
Lines.EncLines->setColorArray(Lines.colors.get());
Lines.EncLines->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
Lines.EncLines->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::LINES, 0, Lines.index->size() / 2));

Lines.geode->addDrawable(Lines.EncLines.get());

....................

Points.Points.get() is a Vec3Array containing n vertex
Lines.colors.get() is a Vec4Array
Lines.EncLines is the geometry
Lines.geode is the geode

n1 and n2 are 2 index

Lines.index is a UIntArray

don' t draw nothing the method is correct ?
Is there another method ?

_________________________________________________________________
Ami i Quiz? Mettiti alla prova con Duell Live…Gratis su Messenger!
http://specials.it.msn.com/DuelLive.aspx

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to