SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_GL_GetProcAddress

Get an OpenGL function by name.

Header File

Defined in <SDL3/SDL_video.h>

Syntax

SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc);

Function Parameters

const char * proc the name of an OpenGL function.

Return Value

(SDL_FunctionPointer) 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:

Thread Safety

This function should only be called on the main thread.

Version

This function is available since SDL 3.1.3.

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.