Hi Gang,

I'm working on some code where it is desirable to share vertex & normal
arrays across multiple drawables (these are osg::Geometry's), *and* to allow
each drawable to have its own unique color (BIND_OVERALL).  My thinking is
that this can be done using VBOs, but I cannot find any good examples of how
to do so, particularly with normals...

For example - See the two Questions inline below:

Step 1: Create the common Geometry, then:

geom->setSupportsDisplayList(false);
geom->setUseDisplayList(false);
m_vertexBuffer = geom->getOrCreateVertexBufferObject();
m_vertexBuffer->setArray(0,&vertexArray);
m_vertexBuffer->setUsage(GL_STATIC_COPY);

// QUESTION 1: How to map the normal array?

m_vertexBuffer->dirty();
geom->setUseVertexBufferObjects(true);

Step 2: Create a second osg::Geometry node, but set its vertex buffer to the
first one

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

// QUESTION: I want to be able to do geom->setVertexBufferObject(m_vertexBuffer)
// But there is no API. Can this be done?

geom2->setUseVertexBufferObjects(true);

Any help is much appreciated.

cheers,

sean
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to