I suggest you to use just one primitive for all the point cloud, not a
primitive for each point.

  You can use primitive type DrawArrays, try this code:

  lasGeometry->addPrimitiveSet( new
osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, no_points) );

  instead of the for loop you are using.

  It should consume much less memory and speed it up considerably.


  Cheers!
  Javier Taibo.



On Thu, Oct 28, 2010 at 6:41 PM, Vipin Panwar <[email protected]> wrote:

> Hi,
>
> I am reading the points from LAS file and rendering the data. The data is
> not dynamically updated. I am pasting the subset fo code. So that you can
> find out how I am rendering the points.
>
> for(unsigned long k = 1; k < no_points; k ++)
>        {
>
>
> lasVertices->push_back( osg::Vec3( x_coord, y_coord, z_coord));
>                }
>             free(buff);
>    }
>
>        colors->push_back(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f) );
>        lasGeometry->setVertexArray( lasVertices);
>        lasGeometry->setColorArray(colors);
>        lasGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
>
>        for(prim = 0 ; prim < no_points-1; prim = prim + 1)
>    {
>                lasPrim = new
> osg::DrawElementsUInt(osg::PrimitiveSet::POINTS);
>                lasPrim -> push_back(prim);
>                lasGeometry->addPrimitiveSet(lasPrim);
>    }
>
>        //lasGeometry->addPrimitiveSet(lasPrim);
>        osg::ref_ptr<osg::StateSet> state = root->getOrCreateStateSet();
>        state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
>
>        //osg::PolygonMode* pm = new
> osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE );
>        // Force wireframe rendering.
>        //state->setAttributeAndModes( pm, osg::StateAttribute::ON |
> osg::StateAttribute::OVERRIDE );
>
>        viewer.setSceneData( root );
>        viewer.addEventHandler( new PickHandler );
>        viewer.addEventHandler(new osgViewer::StatsHandler);
>        viewer.addEventHandler(new osgViewer::WindowSizeHandler);
>        viewer.run();
>        viewer.realize();
>
>            while( !viewer.done() )
>            {
>                viewer.frame();
>             }
>
>
> Thank you!
>
> Cheers,
> Vipin
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=33194#33194
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Javier Taibo
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to