Thanks for your replying, Garrett

I’m using QT 4.1.4

But my current problem is that I can’t even display the texts, you’ve done
that successfully, could you please show me some clue?

Thanks in advance.

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Garrett Potts
Sent: 2006?12?19? 20:33
To: osg users
Subject: Re: [osg-users] frame rate for simplerviewerQT4

 

Hello:

 

Which Qt are you using?  I was using 4.1.4 and the rate was good but when I
upgraded to 4.2.x the rate was very bad.  So this made me move back to
4.1.4.  The other problem is we are going through timer events which have
has it's own overhead and have no control over this within the application.
I made a similar statement a few weeks ago and was suggested to maybe try to
re-write using a threaded loop.  This would give the control you need to
achieve the framewrate desired since it elliminates the GUI overhead of
Timer events.  Just haven't tested the safety of this within Qt and it's
QGlWidget and to see what needs to be locked for entry.  I think the updates
and culls are Ok but am unclear how the effect of the draw routine within
this type of setup until I try it.

 

 

Take care

 

Garrett

On Dec 19, 2006, at 7:11 AM, xiaoshuxing wrote:





Hi, everyone

I found that simplerviewerQT4 can’t show the framerate like
osgProducer::viewer, so I wrote one myself, it’s basically a
GUIEventHandler.

But, it’s so weird that the text just don’t show out.

The calculation is finished, which I have traced down. 

I have set a breakpoint in the drawimplementation of osgText::text, however,
it seems that this drawimplementation is not executed.

The source code of my eventhandler is as following:

bool MyEventHandler::handle(const osgGA::GUIEventAdapter &ea,
osgGA::GUIActionAdapter &aa)

{

       if(!_firstFrame.valid())

       {

              _firstFrame = new osg::FrameStamp;

              *_firstFrame = *(_sceneView->getFrameStamp());

              _lastFrame = new osg::FrameStamp;

              *_lastFrame = *_firstFrame;

       }

 

       if(true) // make the display or not an user interface later

       {

              if(ea.getEventType()==osgGA::GUIEventAdapter::FRAME)

              {

                     char frText[128];

 

                     osg::ref_ptr<osg::FrameStamp> currentFrame = new
osg::FrameStamp;

                     *currentFrame = *(_sceneView->getFrameStamp());

                     if
(currentFrame->getFrameNumber()==_lastFrame->getFrameNumber())

                     {

                            return false;

                     }

                     

                     double timePerFrame = currentFrame->getReferenceTime()
- _lastFrame->getReferenceTime();

                     sprintf(frText,"%4.2f",1.0/timePerFrame);

                     _frameRateCounterText->setText(frText);

 
_frameRateLabelText->drawImplementation(_sceneView->getRenderInfo());

 
_frameRateCounterText->drawImplementation(_sceneView->getRenderInfo());

                     //std::cout << 1.0/timePerFrame << std::endl;

 

                     _lastFrame = currentFrame;

              }

       }

 

       return false;

}

 

And there’s another weird thing, I put my frame rate result to the console,
and I found that the highest framerate is only 40 fps even when I’m not
drawing anything.

_______________________________________________

osg-users mailing list

[email protected]

http://openscenegraph.net/mailman/listinfo/osg-users

http://www.openscenegraph.org/

 

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to