- Online Community Forums » Programming Questions » open_gl limits frame rate

This thread is locked; no one can reply to it. rss feed Print
open_gl limits frame rate
Michael Weiss
Member #223
April 2000

I have never done anything with open_gl before.

I am trying to get my game working in linux (it works fine in windows)
and have run into a problem with open_gl

When I run my game with no frame rate limits, its capped by the refresh rate
of the desktop. (only in open_gl)

First of all I run it unlimited to test how it will perform on different
types of machines, different window sizes, etc. I want to know how many
frames per second I can get wide open, no limits.

On windows d3d I can get from 80-500fps depending on my display window size,
pixel format, etc.

When I run it in open_gl I am capped at 60fps (or 40 if I set my monitor refresh
rate to that)

After searching, I believe its because with open_gl, al_flip_display() is waiting
for a vertical retrace.

I have tried to get around this by creating my display with different combinations
of display options:
ALLEGRO_VSYNC 2 (should disable vsync)
none of these had any effect.

I think there is an option in open_gl: 'GLX_EXT_swap-control'
that might be able to do what I want (disable vsync for swap)
but I can't figure out how to access it.

I tried this from the docs but it wont even compile:

ALLEGRO_OGL_EXT_LIST *al_get_opengl_extension_list(void)

if (al_get_opengl_extension_list()->ALLEGRO_GL_ARB_multitexture) {

error: invalid use of incomplete type 'ALLEGRO_OGL_EXT_LIST {aka struct ALLEGRO_OGL_EXT_LIST}'

i also tried this:
ALLEGRO_OGL_EXT_LIST * aol = al_get_opengl_extension_list();
if (aol->ALLEGRO_GL_ARB_multitexture) {

got the same error...??

also tried with
if (al_get_opengl_extension_list()->GLX_EXT_swap_control) {

same error:

moving on I then tried:

if (al_have_opengl_extension("ALLEGRO_GLX_EXT_swap_control"))
printf("have swap control\n");

this compiles and runs but I cant seem to find a name that matches

I'm thinking I might have to use


if I could only figure out the name of the function that I need and how to use it..

I found this:

that might be what I need, but I am completely lost as how to go about it.

Sorry for the long rambling post...

Can anyone who knows more about open_gl help me?

I really don't want to do any open_gl drawing.
I'm perfectly happy using the allegro api.
I just want to remove the vsync block on al_flip_display();


Chris Katko
Member #1,881
January 2002


limits frame rate

OpenGL limits your framerate to your monitor, if your driver tells it to. That's because normally there's no point in having higher framerate because your monitor can't display more than the refresh rate it runs at.

You can configure your driver, or, pass this parameter BEFORE your program on the command line.

 __GL_SYNC_TO_VBLANK=1  ./my_program

This one MIGHT only work with nVidia closed-source drivers. There's another command I've used before. I'm looking for it at the moment... because it was =0, =1, and =2. For "application specific", "force on" and "force off."

here it is!

export vblank_mode=0

(then run your program)


Try =0, =1, and =2. (Wow, there's a 3 now?!)


0 - Never synchronize with vertical refresh, ignore application's choice

1 - Initial swap interval 0, obey application's choice

2 - Initial swap interval 1, obey application's choice

3 - Always synchronize with vertical refresh, application chooses the minimum swap interval


If your driver is already set to "Application specific" then it's likely you just need to pass ALLEGRO_REQUIRE with VSYNC=0 before creating your display. But since you say that doesn't work, it's likely that your driver is set to override application settings.

“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Michael Weiss
Member #223
April 2000

Thanks Chris!

There is so much useful information in your reply...

Right away I got the results I was looking by running my program like this:

vblank=0 ./myprog

I will try the other options later...

Thanks again for your very informative post

Go to: