|
From: Emiliano <sky...@fa...> - 2004-02-27 15:02:34
|
To any Win programmer listening... who would be sure better than me :) I have this problem: I have a 3 threaded app. One thread is for timing, one for drawing, and the last reads windows messages. I need a working temporization. I've used both the "TimerFunc()" and the "Sleep()" functions in the timer thread but both don't seem to be too precise. The timer thread uses an Event object to awake the drawing thread. I used a timeout of 20 ms and I get 32 fps (instead of 50). I've tried with 10 ms, and I get 64 fps :D instead of 1000/10 = 100...!! I know I can reach that speed, since I draw a very simple scene, and my system can do it (tested with other apps), and the video-refresh of my current video mode is right 100-101 Hz. Is there some better way to achieve decent temporization? some library that allows using interrupts or something similar? thanks in advance, Emiliano PS I need this for an OpenGL program, I've only found nasty busy-waiting loops with "PeekMessage()" and some drawFrame() + SwapBuffers() elsewhere... that works ok most of the time, but if you try to put your window in the background, the CPU usage reaches instantly 100%, and that sucks!! |