[Qt-interest] Please help design a Qt framework for OpenGL

Joe Liu passer.by007gg at gmail.com
Tue Feb 2 02:34:45 CET 2010


Hi Richard,

thanks for your reply. However, I believe you've misunderstood my ideas.
Basically, I am not working on animation or a video game, and we usually use
this general framework mentioned in my last email to exhaust rendering
capability, so that we can find out how fast our method will be.

We can easily find this framework in many articles, like Nehe's articles,
and they also use this to control or count the FPS value.

Anyway, is there any other suggestions?



2010/2/1 Richard S. Wright Jr. <rwright at starstonesoftware.com>

> This is in general a bad idea. You should sync to your vertical refresh,
> typically something like 60. If you get a buffer swap on the vertical
> refresh, you get no tearing. If you do your animations based on the 1/60
> second time interval instead of timing the C++ code to render a scene, you
> will get silky smooth animation to boot. If you can't achieve 60 fps, drop
> it to 30fps (swap every two syncs). 30 fps actually looks smoother than 45
> or 50 fps when rendered this way. 60fps actually can look far better than
> 100fps too when done properly. Put as much "heavy lifting" on a worker
> thread as you can so you don't clog up the main thread. If your that
> performance sensitive, you aren't going to be doing a lot of GUI things (or
> using timer messages, keyboard messages, etc.) anyway, and blocking on the
> main thread for a buffer swap isn't going to kill you.
>
> Just about everyone in the simulation business knows this (or at least used
> to), but it seems to be "hidden" knowledge among many game programmers. The
> graphics card vendors want to focus on fps because it's a "muscle" figure.
> It's important to be sure, the faster you render the more time you have left
> over in that 1/60 second for other things... but it's that time left over
> you want, not an excess number of frames per second.
>
> Richard
>
> On Feb 1, 2010, at 8:42 AM, Joe Liu wrote:
>
> Hi,
>
> I know it's quite convenient to use QGLWidget to write your OpenGL app
> within Qt;
>
> However, my issue is to make a framework to do more control on FPS of
> OpenGL Rendering by, maybe, utilizing QEventLoop;
>
> We might use the following framework on plain Win32 APIs in an OpenGL app:
> -----------------
> int main()
> {
>     //init Window and OpenGL
>
>     Messageloop
>     {
>        * if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
>         {
>             TranslateMessage(&msg);
>             DispatchMessage(&msg);
>         }
>         else
>         {
>             // I can query system time to help control the FPS
>             sysTime = timeGetTIme();
>             if( sysTime - lastTime > 30 )
>             {
>                 DrawGLScene();
>                 lastTime = sysTime;
>             }
>         }*
>     }
> }
> -----------------
>
> I think in Qt, maybe I need to use QEventLoop to control the message by
> myself;
> But I dont find useful docs or samples about the usage of QEventLoop, or
> about controlling FPS;
>
> Do you have any suggestions? Thanks a lot;
>
> Cheers,
>
>
> Joe
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100202/55fa89ee/attachment.html 


More information about the Qt-interest-old mailing list