Hi Fred Take a look to osg::Array::setVertexBufferObject to assign VertexBufferObject to an array, and to osg::Geometry::get(Vertex | Color | ... | Attrib)Array() to get access to arrays
then Take a look to osg::DrawElement::setElementBufferObject to assign ElementBufferObject and osg::Geometry::getPrimitiveSet()->getDrawElement() to get access to DrawElement. I already have to do this kind of optimization, I have used a NodeVisitor to traverse the graph and assign VBO and EBO to geometries. HTH David 2012/5/21 Fred Smith <[email protected]> > Hi, > > I have some geometry that is making use of a VBO. The VBO contains an > extremely large number of vertices. Similarly, I have an element buffer > (EBO) that contains a large amount of indices. I need to render some > "objects" that reference selected vertices of the VBO and selected indices > of the EBO, sequentially, but under different model-view transformations. > > Basically, what I am trying to achieve with OSG is the following OpenGL > code: > > > Code: > glBindBuffer(my_huge_vbo) > glBindBuffer(my_huge_ebo) > > glLoadMatrix(...); // transformation 1 > glDrawElements(GL_TRIANGLES, 10, ........, > offset_to_EBO_indices_for_object1); // draw the first object under > transformation 1 > glLoadMatrix(...); // transformation 2 > glDrawElements(GL_TRIANGLES, 50, ........, > offset_to_EBO_indices_for_object2); // draw the first object under > transformation 2 > glLoadMatrix(...); // transformation 3 > glDrawElements(GL_TRIANGLES, 8, ........, > offset_to_EBO_indices_for_object3); // draw the first object under > transformation 3 > and so on > > > > My problem is that if I have the following scene graph (see below), I will > have many VBO/EBO buffer bindings, which is what I want to avoid. > > > Code: > - MatrixTransform > - Geode > - Geometry > - MatrixTransform > - Geode > - Geometry > - MatrixTransform > - Geode > - Geometry > > > > Is there a way to manually assign a VBO and an EBO to a geometry? If this > is the case I could share these across different osg::Geometry object > instances. > > Regards > Fred > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=47788#47788 > > > > > > _______________________________________________ > 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

