Try cloning the geoms and only changing their color array.

Brian

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose. •
[EMAIL PROTECTED] wrote: -----

To: osg-users <[email protected]>
From: "Sean Spicer" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
Date: 12/01/2008 05:35PM
Subject: [osg-users] VBOs & Shared Geometry

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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to