[osg-users] VBOs & Shared Geometry

Robert Osfield robert.osfield at gmail.com
Tue Dec 2 01:14:43 PST 2008


Hi Sean,

osg::Geometry provides an automatic VBO setup for you when you
setUseVertexBufferObjects(true), but this is only done on a per
Geometry basis, the code assumes that there is just one geometry in
play.

If you want to use assign VBO's to Array's individually then you'll
need to assign the VBO's to the Array's yourself.

Robert.

On Mon, Dec 1, 2008 at 10:35 PM, Sean Spicer <sean.spicer at aqumin.com> wrote:
> 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 at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list