Not really enough information. When "SLOW CODE" is enabled, did you run a profiler to determine whether the bulk of your time is being spent in "SLOW CODE" or elsewhere in OSG? If elsewhere in OSG, did you determine where? What kind of stats output did you get when you enable the osgviewer statistics view? Is it possible that your Geometry object was inadvertently left with display lists enabled (which you would certainly want to disable in such a case)? What is the value of "test_load_resolution"? Do you see the same performance hit when you eliminate the doubly-nested loops and simply do a straight replace of the vertex array with new data? Can you describe the structure and organization of your scene graph? Are you using buffer objects? Are you displaying on multiple screens/pipes? Etc. (Hard to debug remotely, as you can see.) -Paul
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shawn Cook Sent: Friday, October 26, 2007 2:20 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] OSG Performance Issues 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 ^^^^ viewer.sync(); viewer.update(); viewer.frame(); } 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! -Shawn _____ Windows Live Hotmail and Microsoft Office Outlook - together at last. Get it now! <http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL1006269 71033>
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org