SDL_GL_GetSwapInterval(3)

πŸ’– SDL_GL_GetSwapInterval(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_GL_GetSwapInterval β€” she's the one who tells you how your OpenGL context is vibing with vsync. πŸ¦‹


✨ NAME ✨

SDL_GL_GetSwapInterval β€” get the swap interval for the current OpenGL context. πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_video.h>

bool SDL_GL_GetSwapInterval(int *interval);

✨ DESCRIPTION ✨

so like, here's the tea β˜•: if the system literally cannot figure out the swap interval, or if there's just no valid current context hanging around, this function will set *interval to 0 as a safe default. no drama, no crash, just a chill little zero. πŸ’…


✨ FUNCTION PARAMETERS ✨

  • interval β€” this is your output interval value, and she comes in three flavors, bestie:
    • 0 β€” there is no vertical retrace synchronization. free-spirited. unbothered. 🌈
    • 1 β€” the buffer swap is synchronized with the vertical retrace. synchronized queen behavior. πŸ‘‘
    • -1 β€” late swaps happen immediately instead of waiting for the next retrace. she does NOT wait. πŸ’€

✨ RETURN VALUE ✨

Returns true on success or false on failure β€” and if it fails, call SDL_GetError() for more information, because she will tell you what went wrong. πŸ”₯


✨ THREAD SAFETY ✨

🚨 bestie listen. This function should only be called on the main thread. Do not be cute about it. Do not try it from a worker thread. Just don't. πŸ™ˆ

✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. ✨


✨ SEE ALSO ✨


and that's the whole page, no cap. πŸ’œ this little slice of the manual was brought to you by Simple Directmedia Layer, running on SDL 3.4.18, and yeah she's giving SDL_GL_GetSwapInterval(3) energy from start to finish. mwah, go forth and sync responsibly. πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from