|
60 FPS limit in linux? |
Frank Drebin
Member #2,987
December 2002
|
I noticed that when running any Allegro 5 program in linux, I can't get more than 60 FPS - even though al_clear_to_color(al_map_rgb(0,0,0)) only is called and nothing is drawn. How does that come? BTW: I am using the Allegro 5 version that can be found in the Ubuntu PPAs |
Eric Johnson
Member #14,841
January 2013
|
1. Are you using a timer? If so, what is it set to? 2. How are you measuring FPS? 3. Is v-sync enabled? 4. Can you post the code?
|
Frank Drebin
Member #2,987
December 2002
|
3. I don't know. At least I didn't enable it myself... 1#include <stdio.h>
2#include <allegro5/allegro.h>
3
4#define duration 5
5
6int frames=0;
7bool quit=0;
8
9int main(int argc,char** argv)
10{
11 if (!al_init()) return -1;
12
13 ALLEGRO_DISPLAY* display=al_create_display(640,480);
14 if (!display) return -1;
15
16 ALLEGRO_EVENT event;
17 ALLEGRO_EVENT_QUEUE* queue=al_create_event_queue();
18 ALLEGRO_TIMER* timer=al_create_timer(duration);
19 al_start_timer(timer);
20 al_register_event_source(queue,al_get_timer_event_source(timer));
21
22 while (!quit)
23 {
24 if (al_wait_for_event_timed(queue,&event,0)) quit=1;
25
26 if (al_is_event_queue_empty(queue))
27 {
28 al_clear_to_color(al_map_rgb(0,0,0));
29 al_flip_display();
30 frames++;
31 }
32 }
33
34 printf("FPS: %i\n",frames/duration);
35
36 al_destroy_display(display);
37 al_destroy_event_queue(queue);
38 al_destroy_timer(timer);
39
40 return 0;
41}
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
ALLEGRO_VSYNC
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Frank Drebin
Member #2,987
December 2002
|
Thanks - didn't know that vsync was enabled... |
Chris Katko
Member #1,881
January 2002
|
You can also configure VSYNC on the driver level. There's at least two ways, google it. I've posted before in these forums but I don't recall the command line arguments. nVidia has one set. And there's one universal set too. It's like VSYNC=1/2/3/4. With 4 maybe being adaptive vsync. -----sig: |
|