On Thu, May 5, 2011 at 12:02 PM, Riccardo Corsi <riccardo.co...@kairos3d.it>wrote:
> Hi Glenn, > > thanks for your reply... > so to avoid the gl state change related to the bind/unbind of the buffers, > have I got to pack multiple geometries into a single one? > yes > > I'd had preferred to keep them separated as each has a "logical" meaning in > my app, > and to have direct access to a single geom when picking. > I have been in the same boat. OSG does not draw Geometry's in the order they appear in the graph; rather it sorts them by state attributes in order to minimize state changes during the draw. (Other things like bins come into play as well.) But VBO/EBO bindings are not part of that state...maybe they should be. Or maybe the bind/unbind methods in State could be smarter about not unbinding a buffer object until a new one needs binding. Not sure what side effects this might have but it's worth experimenting with...? > > Also, I don't understand very much what's advantage in sharing VBOs among > geometries if they are rebound for every geometry rendered. > I thought the gain when creating larger VBO shared among geometries was to > reduce the state changes and obtain better batches down on the graphics HW. Thank you. > > Ricky > > > > On Thu, May 5, 2011 at 17:51, Glenn Waldron <gwald...@gmail.com> wrote: > >> Ricky, >> >> AFAIK, OSG doesn't maintain VBO/EBO bindings as part of its sortable >> state. So I believe they will be bound and unbound for each Geometry, even >> if they are shared. Somebody correct me if I'm wrong. (See >> Geometry::drawImplementation.) >> >> Glenn Waldron / Pelican Mapping / @glennwaldron >> >> >> >> On Thu, May 5, 2011 at 11:40 AM, Riccardo Corsi < >> riccardo.co...@kairos3d.it> wrote: >> >>> Hi All, >>> >>> I revamp this thread as my question is strictly related, as I'm trying to >>> pack multiple geometries into shared VBO. >>> >>> I'm creating a shared osg::Vec3Array for vertices, >>> same for as many vertex attribute as I need, >>> and then assigning these shared arrays to the different geometries >>> (pGeom->setVertexArray() and pGeom->setVertexAttribArray() ) >>> and telling the geometry to use VBO and not display lists. >>> >>> Then I create a new DrawElements for each geometry, with the correct >>> vertex indices offset, >>> and as I want them to share the same EBO underneath, >>> I'm trying with: >>> pDrawElemsUInt->setElementBufferObject(pSharedEBO); >>> pGeom->addPrimitiveSet(pDrawElemsUInt); >>> >>> But I think I' missing something because, with gDebugger, I see that >>> there are as many bindBuffer calls as num-geom * num-shared-buffers. >>> >>> Am I wrong in the way I try to share the drawElems EBO? Or missing >>> something else? >>> Thank you! >>> >>> Ricky >>> >>> >>> >>> >>> On Mon, Jan 3, 2011 at 19:31, Jason Beverage <jasonbever...@gmail.com>wrote: >>> >>>> Hi Terry, >>>> >>>> I was generating all my geometry in code so I wrote some custom code >>>> to pack them tightly into a single vertex array. >>>> >>>> Jason >>>> >>>> On Mon, Jan 3, 2011 at 1:05 PM, Terry Welsh <mogu...@gmail.com> wrote: >>>> > Hi Jason, >>>> > Thank you for the suggestion. I feel like I'm missing something >>>> > still. Is there an Optimizer feature or something that combines >>>> > Arrays for you? Or did you write a bunch of custom code that >>>> > processes your models after you load them? >>>> > -- >>>> > Terry Welsh >>>> > mogumbo 'at' gmail.com >>>> > www.reallyslick.com >>>> > >>>> > >>>> > >>>> >> Message: 3 >>>> >> Date: Sun, 2 Jan 2011 21:28:12 -0500 >>>> >> From: Jason Beverage <jasonbever...@gmail.com> >>>> >> To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org> >>>> >> Subject: Re: [osg-users] large VBOs for multiple Drawables >>>> >> Message-ID: >>>> >> <aanlktin2mdb-vewdrpkp0rwjxcok2jm4o0vdx31ao...@mail.gmail.com >>>> > >>>> >> Content-Type: text/plain; charset=ISO-8859-1 >>>> >> >>>> >> Hi Terry, >>>> >> >>>> >> You can pack the verts of your small objects into a single >>>> >> osg::Vec3Array and share that array across multiple osg::Geometry >>>> >> objects then use DrawElements for each geometry with the correct >>>> >> indices. I've just recently done this actually for a project I'm >>>> >> working on and it's worked out great. >>>> >> >>>> >> Thanks, >>>> >> >>>> >> Jason >>>> >> >>>> >> On Sat, Jan 1, 2011 at 6:21 PM, Terry Welsh <mogu...@gmail.com> >>>> wrote: >>>> >>> I found some email threads that hinted at this a little, but nothing >>>> >>> seemed very specific. ?I have scenes where display lists perform a >>>> bit >>>> >>> better than VBOs. ?My best guess is because my objects have >>>> relatively >>>> >>> small vertex counts (usually between 20 and 200). ?Is there any way >>>> in >>>> >>> OSG to use one large VBO to store the date for multiple Drawables in >>>> >>> order to minimize buffer state changes? >>>> >>> -- >>>> >>> Terry Welsh >>>> >>> mogumbo 'at' gmail.com >>>> >>> www.reallyslick.com >>>> >>> _______________________________________________ >>>> >>> osg-users mailing list >>>> >>> osg-users@lists.openscenegraph.org >>>> >>> >>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>> > _______________________________________________ >>>> > osg-users mailing list >>>> > osg-users@lists.openscenegraph.org >>>> > >>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>> > >>>> _______________________________________________ >>>> osg-users mailing list >>>> osg-users@lists.openscenegraph.org >>>> >>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>> >>> >>> >>> _______________________________________________ >>> osg-users mailing list >>> osg-users@lists.openscenegraph.org >>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>> >>> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org