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

Reply via email to