Ümit Uzun,
 
I would suspect that the problem you described is related more with you 
graphics card then with the size of the window you are rendering into.  It 
sounds like, in your case, the larger window size would cause more raster 
operations to be performed, while decreasing the size of the window would cause 
fewer raster operation to be performed.
 
Forest,
 
I cannot give you much advice on how to improve the performance when I do not 
know much about your current implementation.  I will assume that your MFC 
application is trying to get to 60 FPS.  With this assumption, your application 
will only have ~16 ms to do even, update, cull, and draw traversals and merge 
any databases, assuming you are using the pager.  If your event traversal is 
taking longer than you want, you might think of adding a worker thread at a 
lower priority that can process the data and report to the render thread, 
several frames later, when the job has finished and can be merged.  This 
assumes you are not working on an active part of the scene graph already.
 
Also, you are working with two different threads.  This means you will have a 
GUI thread and the rendering thread.  There might be extra safeguards ( mutex 
locks ) that are going on behind the scenes.  The best thing to do is move the 
creation of the window to the rendering thread.  By doing this, all messages 
that are sent to this window will be on the same thread as the rendering 
thread.  This way you can manipulate the scene graph without having to push 
data into the event handler, but this will also break portability if you decide 
to have cross platform code.

Ryan H. Kawicki 
The Boeing Company 
Training Systems & Services 
Software Engineer 

 


________________________________

        From: Ümit Uzun [mailto:umituzu...@gmail.com] 
        Sent: Friday, July 10, 2009 7:53 AM
        To: OpenSceneGraph Users
        Subject: Re: [osg-users] what is the thread difference between MFC 
andconsole?
        
        
        Hi Forest;
        
        We have same problem and I find that threading isn't actual problem. 
real one is rendering on specified HWND. And frame rate always gets down while 
enlarging the HWND size contrary if you collapse the HWND size you can see 
easily that frame rate gets upper degree than wide one. I suspect that low 
frame rate is caused by rendering on specified HWND. If you really need to 
render on MFC control(i.e PictureBox) you should narrow you HWND control size 
to get high frame rate.
        
        Regards.
        
        Ümit Uzun
        
        
        
        2009/7/10 forest <fores...@163.com>
        

                hi all,
                     I have a problem with OSG in MFC program:When I run my 
program in console, I get 60 frames per second .However,When I move my program 
into MFC, I get slow frames.I do this as the example osgviewerMFC does, 
creating a new thread for OSG drawing. One thing I have to mention is that 
there is some time-consuming algorithms in my event handler .
                    What should I do to improve my program in MFC?
                    Thanks in advance.
                    Best regards.
                forest

                _______________________________________________
                osg-users mailing list
                osg-users@lists.openscenegraph.org
                
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
                
                


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to