sdlGlMakeCurrent function video

bool sdlGlMakeCurrent(
  1. Pointer<SdlWindow> window,
  2. Pointer<SdlGlContext> context
)

Set up an OpenGL context for rendering into an OpenGL window.

The context must have been created with a compatible window.

\param window the window to associate with the context. \param context the OpenGL context to associate with the window. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GL_CreateContext

extern SDL_DECLSPEC bool SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context)

Implementation

bool sdlGlMakeCurrent(
  Pointer<SdlWindow> window,
  Pointer<SdlGlContext> context,
) {
  final sdlGlMakeCurrentLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlWindow> window,
          Pointer<SdlGlContext> context,
        ),
        int Function(Pointer<SdlWindow> window, Pointer<SdlGlContext> context)
      >('SDL_GL_MakeCurrent');
  return sdlGlMakeCurrentLookupFunction(window, context) == 1;
}