|
60Hz with Allegro? |
Zepper
Member #8,715
June 2007
|
- You know that 1000/60 = 16.67, and 16x60 = 960 miliseconds. In other words, Allegro doesn't keep my program running at exactly 60Hz - it keeps around 62~63 frames-per-second (62.5 is the result). The function to request a 60Hz refresh (request_refresh_rate(60)) doesn't work, even if the Windows monitor is set to 60Hz, Allegro keeps displaying 70Hz of refreshing. - There's only the milisecond as precision? No turn arounds? Yes, my system is Windows XP, using MinGW + Dev-Cpp.
|
gnolam
Member #2,030
March 2002
|
1) Show us your initialization code. -- |
Kibiz0r
Member #6,203
September 2005
|
Might be helpful to see the main loop, too. --- |
Zepper
Member #8,715
June 2007
|
- I use exactly what extimer.c does. Anyway, I get 62~63 FPS, but the get_refresh_rate() still returns 60, the retrace count returns 71~72 at every sync. No, I don't use vsync(), but this...
- The refresh_screen() is called when an entire PPU frame is done. Things run around 110 FPS with no control, of course. Anything more?
|
Kris Asick
Member #1,424
July 2001
|
Three things. 1. request_refresh_rate() needs some work. I've never seen it work properly on Windows. 2. Even if you successfully request the refresh rate you want, it will never be exactly the same every time. No matter what, your Allegro timer will slowly drift away from the monitor's refresh. The only ways you can time perfectly to the monitor is to use vsync(), page flipping (which also uses vsync()) or learn triple buffering. 3. Timing only to the monitor is a very bad idea since not every user will have the same refresh rate and since request_refresh_rate() isn't reliable. If you want your game to be timed accurately you will need to resort to a timer. Thus, unless you're doing real-time logic, monitor synchronization plus accurate game timing are impossible to combine without frame loss. --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
gnolam
Member #2,030
March 2002
|
1) You're not showing us how you set up your graphics mode. -- |
Zepper
Member #8,715
June 2007
|
Fair enough, here...
- I use a config file, where the user can specify a gfx mode and a resolution. I gathered all those variables into a structure. video->gfx_card selects a video mode, even with the poor "card" label though, since it's not a card anyway. - The other stuff does not affect the gfx, except for the 16-bit mode indexed by a palette array.
|
|