Hi Roman, I'm juggling too many different tasks right now to dive into what you are doing, but as a general note I'd mention that OSG svn/trunk has a much more flexible approach to PBO/EBO and VBO's including a buffer object pool that enables recycling of all types of BO's. So... I'd recommend having a look at svn/trunk.
Robert. 2010/6/15 Roman Grigoriev <[email protected]>: > Hi Robert! > The question was how can I draw my geometry using elements from start index > to end index. And as far as I understand I have to delete whole ebo, and > then create new ebo with new bounds. I simply want to do it more efficiently > without remapping buffers. > Roman. > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Robert > Osfield > Sent: Monday, June 14, 2010 12:06 PM > To: [email protected] > Subject: Re: [osg-users] Draw dynamic line with LODs and EBO > > Hi Roman, > > 100,000 points is nothing for a modern graphics card, they can happily > handle 10 times that are 60Hz. Given this I would say just create you > geometry efficiently and your done, no need to complicate things > further. > > Robert. > > On Fri, Jun 11, 2010 at 3:27 PM, Roman Grigoriev <[email protected]> > wrote: >> Hi, >> I have to make in my app dynamic lines. As far as I know display lists are > deprecated for now on GLES2 platform I try to make it using VBO+EBO, like in > osgparametric,so now it works fine. But I have to draw up to 1000 lines > with 100 points so it can be so hard to GPU. So I decided to recalculate EBO > using LOD strategy. So I'll calculate distance to my point and remove odd > indices. Could you please give me some snippet how to work with EBO in > update or draw callback? >> Also my lines are trajectories and I have to draw them respectively to > simulation time. But I found that I can't change size of element buffer. >> Because I found in PrimitiveSet.cpp >> this lines >> >> Code: >> >> void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) > const >> { >> ....... >> if (ebo) >> { >> if (_numInstances>=1) state.glDrawElementsInstanced(mode, > size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), > _numInstances); >> else glDrawElements(mode, size(), GL_UNSIGNED_INT, (const > GLvoid *)(ebo->getOffset(getBufferIndex()))); >> } >> } >> >> >> >> so here size() - total size of element buffer and I create for example EBO > with 200 indices total and want draw only first 100 indices - how can I make > it? >> >> for the reference here is my code >> >> Code: >> >> osg::Node* createModel( bool dynamic, bool useVBO) >> { >> osg::Geode* geode = new osg::Geode; >> osg::Geometry* geom = new osg::Geometry; >> geode->addDrawable(geom); >> osg::Vec3 row(0.0f,0.0f,0.0); >> unsigned int num_x = 200; >> unsigned int num_y = 20; >> unsigned int vert_no = 0; >> osg::Vec3Array* vertices = new osg::Vec3Array( num_x ); >> >> unsigned int iy; >> for(iy=0; iy<num_x; iy++) >> { >> (*vertices)[vert_no++] = row; >> row.y()=1000.0f*iy; >> row.z()+=100; >> } >> geom->setVertexArray(vertices); >> osg::VertexBufferObject* vbo = useVBO ? new osg::VertexBufferObject : 0; >> if (vbo) vertices->setVertexBufferObject(vbo); >> osg::ElementBufferObject* ebo = useVBO ? new osg::ElementBufferObject : 0; >> osg::DrawElementsUInt* elements = new > osg::DrawElementsUInt(GL_LINE_STRIP_ADJACENCY_EXT, num_x); >> unsigned int element_no = 0; >> for(unsigned int ix = 0; ix<num_x; ix++) >> { >> (*elements)[element_no++] = ix; >> } >> >> geom->addPrimitiveSet(elements); >> geom ->setDataVariance(osg::Object::DYNAMIC); >> geom->setDrawCallback(new DrawCallback()); >> if (ebo) elements->setElementBufferObject(ebo); >> geom->setUseVertexBufferObjects(useVBO); >> return geode; >> } >> >> >> >> ... >> >> Thank you! >> >> Cheers, >> Roman[/code] >> >> ------------------ >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=28826#28826 >> >> >> >> >> >> _______________________________________________ >> 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 > > > _______________________________________________ > 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

