Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In OpenGL, is there a way to ensure I get exactly, no more nor less, 60 (or whatever rate my monitor is set for) frames per second?

Of course given that the new frame can be calculated in less than 1/60 second. I was thinking Windows more than Linux or Mac OSX, even though it is interesting to keep an eye on portability.

share|improve this question
(Question) Isn't this just v-sync? – The Communist Duck Dec 21 '10 at 13:20
up vote 2 down vote accepted

I think you need to go platform specific for this, SDL's SDL_GL_SwapBuffers (i think it's called) will wait for retrace before swapping. If you specify your platform, there might be more we can help you with.


A quick google turned up this:, search the page for 'retrace' and you'll see it.

share|improve this answer
SDL's swapbuffers won't do anything magical if you set your driver settings never to do vsync. – Jari Komppa Jan 14 '11 at 11:23

Synchronizing with the vertical retrace is not only platform dependent, but vendor-dependent and therfore not covered by the OpenGL-Specification.

Additional information can be found here:

share|improve this answer

What you want is called VSYNC. And for your question:

no more nor less, 60

This is imposible, if you are talking about no less. It is depended on how much your app cuts gpu's performance.

No more is not that easy in OpenGL (compared to directx). Opengl doesnt support vsync in its basics, but the extension for VSYNC exists. Problem is that works only on windows.

Best resource for start studying is stack overflow and this QA:

share|improve this answer
It should not be impossible if the app does little enough? – Prof. Falken Dec 21 '10 at 16:36
Of course then it is OK. But you can't say it have to be always ok (if you are thinking mathematicly :-)). Also if you are writing some really frame dependent app be aware of this trouble: I was writing stereoscopic application one frame left, one right (its called page flipping) but before it established to be ok, it took some time. So you cant say the first frame is left or right and user had to perform "switch eye" test on every application startup. – Notabene Dec 21 '10 at 16:54
One frame left, one frame right ... i meaned: one frame for left eye, one for right eye – Notabene Dec 21 '10 at 19:53
Interesting twist. – Prof. Falken Dec 22 '10 at 0:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.