SDL Wiki
[ front page | index | search | recent changes | git repo | offline html ]

SDL_GL_MakeCurrent

Set the currently-active OpenGL context.

Header File

Defined in <SDL3/SDL_video.h>

Syntax

bool SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context);

Function Parameters

SDL_Window * window the window to associate with the context.
SDL_GLContext context the OpenGL context to associate with the window.

Return Value

(bool) Returns true on success or false on failure; call SDL_GetError() for more information.

Remarks

This function makes a GL context "current," in all the ways that term implies in OpenGL.

This is a per-thread state that specifies what context future calls into OpenGL will operate on. Beyond context creation work, you must have a current context for the thread before attempting to use OpenGL in any way.

The context must have been created with a compatible window.

Thread Safety

It is safe to call this function from any thread (as long as a unique GL context was created for that thread).

Version

This function is available since SDL 3.2.0.

See Also


CategoryAPI, CategoryAPIFunction, CategoryVideo


[ edit | delete | history | feedback | raw ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.