OpenGL & Vulkan windowsSDL 3.2
SDL_GL_GetProcAddress
Finds an OpenGL function in the driver by name. Handed to glad to load them all.
Signature
SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc);
How it works
Modern OpenGL functions live in the GPU driver and are looked up at run time; nobody does that by hand. Pass this function to your loader right after creating the context: gladLoadGLLoader((GLADloadproc)SDL_GL_GetProcAddress) (glad 1) or gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress) (glad 2).
Parameters
procconst char *
The function name, e.g. "glGenBuffers".
Return value
The function's address, or NULL if not found.
Example
example.cpp
1if (!gladLoadGLLoader((GLADloadproc)SDL_GL_GetProcAddress)) {
2 SDL_Log("could not load OpenGL");
3 return 1;
4}