Hi Yanling,

I'd recommend against using vertex indices as this will drop the
osg::Geometry down to sending all data using OpenGL slow paths - and
bypass VBO's.

Use straight vertex arrays without indices and use
osg::DrawElementsUShort primitives to do the index, this combination
will keep you on OpenGL fast paths, and allow you to take advantage of
VBO's where supported.

However, you might still fine display lists faster...  it all depends
on your data, and your graphics hardware/drivers.

Robert.

On 6/22/06, Yanling Liu <[EMAIL PROTECTED]> wrote:
Hi, please tell me whether following code is the corret way to use VBO in
OSG.

osg::Geometry *baseGeom = new osg::Geometry;
baseGeom->setVertexArray(vvp);
baseGeom->setColorArray(ccp);
baseGeom->setNormalArray(nnp);
baseGeom->setVertexIndices(iip);
baseGeom->setNormalIndices(iip);
baseGeom->setColorIndices(iip);
baseGeom->addPrimitiveSet(new
DrawArrays(PrimitiveSet::TRIANGLES, 0, iip->size()));
baseGeom->setNormalBinding(Geometry::BIND_PER_VERTEX);
baseGeom->setColorBinding(Geometry::BIND_PER_VERTEX);

baseGeom->setSupportsDisplayList(false);
baseGeom->setUseDisplayList(false);

baseGeom->setUseVertexBufferObjects(true);

Do I need to do anyting else to use VBO in OSG?

Thanks. Yanling


_______________________________________________
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