On 2/23/07, Kamaze <[EMAIL PROTECTED]> wrote:
Like i said, i got the best average FPS/CPU usage ratio with one SDL_Delay(1) call each 5 frames.
On your computer, that is. The obvious problem with hard-coding something like this is that it will very likely not be the best on other people's computers. If someone's computer is struggling to keep up a minimum of frames to play the game, then adding delay calls every 5th frame will hurt. Besides, calling SDL_Delay(1) is the same as calling the OS scheduler's yield command. You tell the OS scheduler that now other processes can run, even if they could have waited. There is no way to know how long the OS scheduler will take to get back to your process. If there is a low-priority IO-bound process in the background, giving it lots of time slices can kill your framerate completely. So you will want to measure the results like SDL_framerateDelay tries and offset problems like that.
If we/you want to use SDL_Framerate() as something like V-Sync, then it may be better to use the http://www.opengl.org/registry/specs/EXT/wgl_swap_control.txt extension.
SDL 1.2.10 has support for setting vsync control through the SDL_GL_SetAttribute() call with the SDL_GL_SWAP_CONTROL parameter. However, support on various setups and drivers varies, and so you cannot assume that it will work. Nor can we assume that everyone has SDL 1.2.10. Using the swap control GL extensions directly does not help, since that is what SDL does anyway. I know that since I wrote the patch to add that feature to SDL. Besides, now that more people are getting LCD monitors, vsync control is increasingly irrelevant. - Per _______________________________________________ Warzone-dev mailing list [email protected] https://mail.gna.org/listinfo/warzone-dev
