Hi,

I am new to OSG.  I am trying to draw a lot of spheres into a scene.  By lots I 
mean on the order of a 100,000 or so.  This really brings my simple test app to 
its knees.  Here is the current way I am drawing these spheres:


Code:

osg::Sphere *unitSphere = new osg::Sphere(osg::Vec3(0,0,0),5.0);
osg::ShapeDrawable* unitSphereDrawable = new osg::ShapeDrawable(unitSphere);

for(1...100,000)
{
    osg::PositionAttitudeTransformation *shpereXForm = new 
osg::PositionAttitudeTransformation();
    sphereXForm->setPosition(position);
    osg::Geode* unitShpereGeode = new osg::Geode();
    sphereXForm->addChild(unitSphereGeode);
    unitSphereGeode->addDrawable(draw);
    GetScene()->AddDrawable(unitSphereGeode);
}




Our current product uses straight 2D OpenGL calls and uses points instead of 
spheres to draw the dataset.  We are currently porting everything to 3D using 
OSG and found that we might have to do something unique when it comes to 
displaying the dataset we are trying to display.  The dataset we are trying to 
draw doesn't persist over time.  Its there one second and gone the next.  I 
need a quick way to draw lot of spheres very quickly.  I  have started looking 
into overriding the Camera::DrawCallback and add raw OpenGL calls.  Is this the 
right path to look down or is there something easier?

I apologize in advance if there is a simple answer to this that a newb like me 
should have seen or something I am doing completely wrong.

Thank you!

Cheers.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=21774#21774





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

Reply via email to