[osg-users] Sharing a VBO and EBO between multiple geodes
osgforum at tevs.eu
Wed Apr 6 03:41:25 PDT 2011
I'm trying to share a VBO and an EBO between multiple primitivesets of different geodes. My structure is the following (I always have only one primitiveset per geode, hence my question)
and so on
I've tried to do it in 2 different ways:
1) By first creating one unique ElementBufferObject and one unique VertexBufferObject for the whole scene graph, but then creating individual, distinct vertex arrays for each primitivesets, eg:
int numberOfVertexArrays = 0;
Geometry *geom = new Geometry(); // create my geometry
Vec3Array *arr = new Vec3Array(); // 1 distinct vertex array for each geometry
arr->setVertexBufferObject(uniqueVbo); // use the unique VBO
For the EBO, I use DrawElements::setBufferIndex(), my index being the index of the vertex array I'm adding to the EBO.
DrawElements *drawElements = [...];
2) By creating one unique EBO and one unique VBO, and having only one unique vertex array, too. Everything's pretty much unique.
In both cases, OSG keeps binding/unbinding Array and Element buffers inbetween glDrawElements calls. I mean, OSG even does this when VBO and EBO buffer ids don't change across glDrawElements calls.
Isn't there a way to bind the VBO and EBO once for all at the beginning and then render everything?
Or do I *have* to have everything declared in the same geometry?
Read this topic online here:
More information about the osg-users