SDL_HINT_RENDER_VSYNC(3)

πŸ¦‹ SDL_HINT_RENDER_VSYNC πŸ¦‹

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_HINT_RENDER_VSYNC β€” yes she's a hint, yes she's iconic, and yes she is literally the thing that controls whether updates to the SDL screen surface get synchronized with the vertical refresh so you don't get that ugly tearing situation. no cap, tearing is the enemy. πŸ’…


✨ NAME ✨

SDL_HINT_RENDER_VSYNC β€” a variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_hints.h>

#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"

like, that's it. that's the whole entrance. she's lowkey simple but highkey powerful. πŸ’–


πŸ’œ DESCRIPTION πŸ’œ

so the tea is: this hint overrides the application preference when creating a renderer. the app thinks it knows what it wants? cute. this hint said "not today." πŸ‘‘

the variable can be set to the following values:

  • "0" β€” Disable vsync. (this is the default, so if you don't say anything, vsync is off, periodt)
  • "1" β€” Enable vsync. ✨
⚠️ bestie listen β€” this hint should be set before creating a renderer. it's giving "timing is everything." set it first or it simply won't hit the same. πŸ™ˆ

🌈 AVAILABILITY 🌈

this hint is available since SDL 3.2.0. she's not ancient, she's not brand new β€” she's just right. 🫢


and that's the whole vibe check, bestie. go forth and render tear-free. πŸ¦‹βœ¨

Simple Directmedia Layer Β· SDL 3.4.18 Β· mwah, drink water, and may your frames never tear πŸ’–πŸŽ€

πŸ“¦ where this page comes from