Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

Normally my app runs at 60 fps, But when I add some simple models it decreases to 40fps.

I think v-sync on, which is might be causing it to run slower.

Is there any way to disable v-sync in WebGL?

Would glflush at the end of rendering work?

share|improve this question
Have you actually profiled the running code? 40 sounds like an odd frame rate for a card to sync at. What happens if you incrementally add more and more models, does it jump down to 20 or does it ease down? – Patrick Hughes Jul 7 '11 at 19:15

In WebGL, Swap Interval is what they call v-sync.

To enable Swap Interval


To disable Swap Interval

share|improve this answer
Does Opengl has any v-sync control function? – iamcreasy Jul 7 '11 at 18:09
Not a webgl command. Any other way? – JoniPichoni Jul 8 '11 at 7:51

WebGL does not have control over v-sync or buffer swapping.

gl.flush is not going to either force or prevent a v-sync. gl.flush "force execution of GL commands in finite time"

If you schedule your draw routine via setInterval or setTimeout it might be detrimential to rendering quality and v-sync artifacts might be more apparent (I have observed this in Chrome, but have not seen a difference in Firefox).

To avoid out of page-redraws you can call requestAnimationFrame to sync up your redraws with the page redraw. However this will not cause v-sync to be either on or off, it merely might reduce the impact of v-sync artifacts, and it makes your app behave more nicely performance wise (because you will not draw if your tab does not have focus).

A drop from 60fps to 40fps might indicate that you're making the GPU busy and you'll need to go over your code to make it faster.

Note that in order to measure accurate performance and exclude other effects, you should capture a start time before drawing, call gl.finish() after you're done, and then take an end time and log the difference into a collection from which you calculate an averaged result.

The gl.finish call ensures you are going to see a true performance measure and not just how fast your commands get commmited to the browsers backlog of WebGL calls (which is asynchronous).

share|improve this answer
Is gl.finish() a synchronized call that essentially stalls until the GPU has finished executing the calls you issued to it asynchronously? – namuol Jan 16 '13 at 5:08

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.