mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Dynamically load glGetString(), to avoid direct dependency on OpenGL.
This commit is contained in:
parent
73936208b0
commit
bafa4c7ae8
@ -162,6 +162,7 @@ SDL_GLContext
|
||||
Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||
{
|
||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||
const GLubyte *(APIENTRY * glGetStringFunc)(GLenum) = NULL;
|
||||
NSAutoreleasePool *pool;
|
||||
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
|
||||
@ -275,7 +276,14 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glversion = (const char *)glGetString(GL_VERSION);
|
||||
glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString");
|
||||
if (!glGetStringFunc) {
|
||||
Cocoa_GL_DeleteContext(_this, context);
|
||||
SDL_SetError ("Failed getting OpenGL glGetString entry point");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glversion = (const char *)glGetStringFunc(GL_VERSION);
|
||||
if (glversion == NULL) {
|
||||
Cocoa_GL_DeleteContext(_this, context);
|
||||
SDL_SetError ("Failed getting OpenGL context version");
|
||||
|
Loading…
Reference in New Issue
Block a user