[osg-users] OSG Performance Issues

Shawn Cook sfncook at hotmail.com
Fri Oct 26 13:20:26 PDT 2007

Hi, I'm back to whine about my performance issues in OpenSceneGraph.  Look at this main loop: 
while( !viewer.done() && !timeToDie)
//*** SLOW CODE ***
osg::Vec3Array *vecs = dynamic_cast<osg::Vec3Array*> (geom->getVertexArray());
if( vecs ) {
for(int i=0; i<test_load_resolution; i++ ){
for(int j=0; j<test_load_resolution; j++ ) {
float left = unit_size*i;
float right = unit_size*(i+1);
float bottom = unit_size*j;
float top = unit_size*(j+1);
int quadIndex = (i*4*test_load_resolution) + (j*4);
vecs->at(quadIndex+0).set(left, bottom, 0.0);
vecs->at(quadIndex+1).set(right, bottom, 0.0);
vecs->at(quadIndex+2).set(right, top, 0.0);
vecs->at(quadIndex+3).set(left, top, 0.0);
//^^^ SLOW CODE ^^^^
When I comment out "SLOW CODE" my framerate is a few hundred frames a second.  But when I uncomment "SLOW CODE" my frame rate won't go above 20fps.  I need dynamic vertices in my application - how do I acheive this with OpenSceneGraph?
Thanks folks!
Windows Live Hotmail and Microsoft Office Outlook – together at last.  Get it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071026/8b7e52a3/attachment-0002.htm>

More information about the osg-users mailing list