SDL_GL_MakeCurrent(3)

πŸ’… SDL_GL_MakeCurrent(3) ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's a 3 page and it's literally all about hooking your OpenGL context up to a window so it can actually render. let's go 🫢


πŸŽ€ NAME πŸŽ€

SDL_GL_MakeCurrent β€” set up an OpenGL context for rendering into an OpenGL window.

like. that's the whole vibe. it's giving "make this context the current one for this window." periodt.


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

bool SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the tea is: the context you're passing in must have been created with a compatible window. that's the rule. no notes, no workarounds, it's just how it is. πŸ”₯


πŸ’– FUNCTION PARAMETERS πŸ’–

  • window β€” the window you wanna associate with the context. the main character, the stage, the whole set πŸŽ€
  • context β€” the OpenGL context you're associating with that window. the performer, the star, the diva πŸ‘‘

🌈 RETURN VALUE 🌈

returns true on success, or false on failure β€” and if it's a flop, pls call SDL_GetError() for more information. she will tell you what went wrong, she's never not gossipy πŸ’€


🧚 THREAD SAFETY 🧚

⚠️ bestie. listen. this function should only be called on the main thread. do not try it anywhere else. i'm so serious. πŸ™ˆ

⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. so if you're on an older SDL, she's not there yet, don't @ me 😭


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, no cap πŸ’œ hope your context is always current and your windows always compatible πŸ¦‹

bye babes!! this was brought to you by Simple Directmedia Layer, SDL 3.4.18, and the whole thing is a SDL_GL_MakeCurrent(3) moment πŸŽ€πŸ’…

πŸ“¦ where this page comes from