![]() |
|
al_flip_display() forces 60fps? |
Gnamra
Member #12,503
January 2011
![]() |
So when I ran the piece of code below I noticed that the fps is locked at 60. 1#include <iostream>
2#include <allegro5/allegro.h>
3#include <allegro5/allegro_primitives.h>>
4
5int main(int argc, char **argv)
6{
7 int frames;
8 double fps, startTime, elapsedTime;
9
10 al_init();
11 al_init_primitives_addon();
12
13 ALLEGRO_DISPLAY *display = al_create_display(800, 600);
14 ALLEGRO_COLOR black = al_map_rgb(0,0,0);
15
16 startTime = elapsedTime = al_get_time();
17 fps = 0;
18 frames = 0;
19
20 while(true)
21 {
22 al_clear_to_color(black);
23 al_flip_display();
24
25 frames++;
26 elapsedTime = al_get_time() - startTime;
27
28 fps = frames/elapsedTime;
29 std::cout << "FPS: " << fps << "\n";
30 }
31 return 0;
32}
|
Chris Katko
Member #1,881
January 2002
![]() |
1) Where do you set ALLEGRO_VSYNC? Quote: void al_set_new_display_option(int option, int value, int importance) ALLEGRO_VSYNC: Set to 1 to tell the driver to wait for vsync in al_flip_display, or to 2 to force vsync off. The default of 0 means that Allegro does not try to modify the vsync behavior so it may be on or off. 2) Is your videocard driver set to force vsync? -----sig: |
Gnamra
Member #12,503
January 2011
![]() |
I set al_set_new_display_option(ALLEGRO_VSYNC, 2, ALLEGRO_REQUIRE) before creating the display. I'm on kubuntu, I haven't installed any drivers yet so I'm using "X.Org X server -- Nouveau display driver" whatever that is, and I have no idea how to check if it's forcing vsync.
|
Neil Roy
Member #2,229
April 2002
![]() |
According to the source code you just showed us, you are not setting the vsync at all. I have used Allegro 5 in my own game and gotten much higher than 60FPS. Things that have effected it are the event timer settings (or any timer settings which effect speed), and system driver default settings. Personally, I usually have my event timer set to 60FPS so it never goes higher, but I have experimented and gotten much more, so in answer to your question, no, al_flip_display() does not force 60FPS. --- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
I was just googling it, and it looks like you can enable/disable vsync on nouveau by editing your xorg.conf file. Section "Device" Identifier "nvidia card" Driver "nouveau" Option "GLXVBlank" "true" EndSection AFAICS, set the fourth line to say Option "GLXVBlank" "false" (or possibly "off"). This xorg.conf file is found in various places, in slackware it's /etc/X11/xorg.conf, Debian (and possibly xubuntu) has it in /etc/X11/xorg.conf.d/20-nouveau.conf BTW, could you try the build/examples/ex_gldepth to see if A5 works correctly with the depth buffer yet? It was messing up a few years ago. {"name":"956181f2a4816479000cccded84c63b3.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/5\/956181f2a4816479000cccded84c63b3.png","w":651,"h":505,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/5\/956181f2a4816479000cccded84c63b3"} “Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.” ― Robert A. Heinlein |
Gnamra
Member #12,503
January 2011
![]() |
Sorry for the slow reply, I had surgery today and had my gallbladder removed because of gallstones. (I had 9 of them :O) @NiteHackr @Arthur Kalliokoski Sure thing, I'll try to run it a bit later today. edit: I ran ex_gldepth and here's the result:
|
|