SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)

SDL_GL_GetProcAddress

Get an OpenGL function by name.

Header File

Defined in SDL_video.h, but apps should use #include <SDL3/SDL.h>

Syntax

SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc);

Function Parameters

proc the name of an OpenGL function

Return Value

Returns a pointer to the named OpenGL function. The returned pointer should be cast to the appropriate function signature.

Remarks

If the GL library is loaded at runtime with SDL_GL_LoadLibrary(), then all GL functions must be retrieved this way. Usually this is used to retrieve function pointers to OpenGL extensions.

There are some quirks to looking up OpenGL functions that require some extra care from the application. If you code carefully, you can handle these quirks without any platform-specific code, though:

Version

This function is available since SDL 3.0.0.

Code Examples

typedef void (APIENTRY * GL_ActiveTextureARB_Func)(unsigned int);
GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0;

/* Get function pointer */
glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func) SDL_GL_GetProcAddress("glActiveTextureARB");

/* It was your responsibility to make sure this was a valid function to call! */
glActiveTextureARB_ptr(GL_TEXTURE0_ARB);

See Also


CategoryAPI, CategoryAPIFunction, CategoryVideo


[ edit | delete | history | feedback | raw ]

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

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