Self

SDL_GL_GetProcAddress

Use this function to get an OpenGL function by name.

Syntax

void* 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.

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);

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:


CategoryAPI, CategoryVideo

None: SDL_GL_GetProcAddress (last edited 2015-04-26 19:19:12 by PhilippWiesemann)