SDL_GL_SwapWindow(3)

πŸ’– SDL_GL_SwapWindow πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS manual β€” and this one is literally the glow-up button for your OpenGL window. πŸ’…βœ¨


✨ NAME ✨

  • SDL_GL_SwapWindow β€” Update a window with OpenGL rendering.

πŸ“œ SYNOPSIS πŸ“œ

#include <SDL3/SDL_video.h>

bool SDL_GL_SwapWindow(SDL_Window *window);

🌸 DESCRIPTION 🌸

So here's the tea: this function is used with double-buffered OpenGL contexts, which are the default. No cap. 🫢

On macOS, make sure you bind 0 to the draw framebuffer before swapping the window, otherwise nothing will happen. If you aren't using glBindFramebuffer(), this is the default and you won't have to do anything extra. Easy peasy. πŸ“


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • window β€” the window to change. (yes, that one right there πŸ‘€)

πŸ”₯ RETURN VALUE πŸ”₯

Returns true on success or false on failure; call SDL_GetError() for more information. Bestie, always check the error if it flops. 😭


🧡 THREAD SAFETY 🧡

This function should only be called on the main thread. Main character energy only, pls. πŸ‘‘


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL 3.2.0. Iconic behavior. 🌈


k bye bestie, this page came from Simple Directmedia Layer, version SDL 3.4.18 β€” go swap those windows and slay πŸ’–πŸ¦‹

πŸ“¦ where this page comes from