[osg-users] OSG Performance Issues

Jeremy L. Moles jeremy at emperorlinux.com
Fri Oct 26 13:55:01 PDT 2007


I figured I'd jump in and respond to this before Robert did, so he
doesn't lose his mind and go crazy. :) We get messages like this a lot,
but they're often by non-native English speakers, and I guess some
amount of tolerance is given to them...

On Fri, 2007-10-26 at 20:20 +0000, Shawn Cook wrote:
> Hi, I'm back to whine about my performance issues in OpenSceneGraph.
> Look at this main loop: 

I would encourage you to read this document:

http://www.catb.org/~esr/faqs/smart-questions.html

Beginning your message like that is the best way to ensure no one
bothers answering it...

> 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?

Without understanding more of exactly what you're trying to do I doubt
anyone can help. The code above is impossible to speculate on without
some additional context...
 
> Thanks folks!
>  
> -Shawn
> 
> 
> ______________________________________________________________________
> Windows Live Hotmail and Microsoft Office Outlook – together at last.
> Get it now!
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list