glutSwapInterval(3)
β¨ glutSwapInterval β freeglut's lil v-sync controller β¨
okay bestie, this is a freeglut page, manual section 3, and it's literally all about controlling how buffer swaps sync up with your display (aka v-sync). yes it's one function. yes it's short. but the vibes are immaculate and the details MATTER, so let's go π
πΈ SYNOPSIS πΈ
void glutSwapInterval(int interval);
one function, one argument, infinite power π«Ά
π ARGUMENTS π
intervalβ the number of vertical blanking periods you wanna wait for before swapping. that's it. that's the whole input. how many v-blanks, bestie?
π DESCRIPTION π
okay so here's the tea β
An interval of 0 requests no synchronization. buffers should be swapped immediately β even if the display device is in the middle of scanning out the previous frame. and what does that get you? visible artifacts, aka tearing π. it's giving chaos. it's giving unfiltered.
An interval of 1 is the standard v-sync setting. the swap happens during the next vertical blanking period, right after the current frame is done being scanned out to the display. classic. reliable. main character energy π
Any other positive interval greater than 1 will wait for that many v-blank periods before swapping. so like, you said 3? bestie you're waiting 3. no notes.
Negative interval values are for "adaptive v-sync". here's how that works:
- If drawing is completed and the swap is ready to be executed before the target v-blank, the swap will be performed at the target v-blank, exactly as if the
intervalwas positive. - If the target interval has elapsed and the swap is running late, instead of waiting more, the swap will be performed immediately, unsynchronized with the display.
late swap? no waiting. just vibes. π¦
β οΈ real talk though: not all GL implementations support all of these semantics. Freeglut will attempt to fall-back to the nearest-equivalent supported swap interval. specifically:
- If adaptive v-sync is not supported, negative values will be flipped to their positive equivalent.
- If running unsynchronized is not possible, an interval of
1will be used instead.
so your fancy negative numbers might just get absolutified. the fallback is fallbacking π
π§ SEE ALSO π§
glutSwapBuffers
π AUTHOR π
John Tsiombikas β nuclear@mutantstargoat.com
and that's the whole page, bestie!! β¨ this freeglut drop is dated October 2025, and the manual name on the tin is glutSwapInterval(3) β freeglut version, October 2025, periodt π
ππ
π¦ where this page comes from
- alpine 3.24: freeglut-doc 3.8.0-r0 Β· MIT
- arch rolling: freeglut 3.8.0-1 Β· X11
- fedora 43: freeglut-devel 3.8.0-1.fc43 Β· MIT
- fedora 43: freeglut-devel 3.8.0-1.fc43 Β· MIT
- fedora 44: freeglut-devel 3.8.0-2.fc44 Β· MIT
- fedora 44: freeglut-devel 3.8.0-2.fc44 Β· MIT
- nixos 26.05: freeglut 3.8.0
- nixpkgs unstable: freeglut 3.8.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms