From e690de25a89298b5c3bfb12689e3265d5625c830 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 7 Apr 2017 02:17:34 +0200 Subject: [PATCH] - Use SDL_GL_GetProcAddress on platforms where the SDL is being used. Since SDL initialized OpenGL for us, it is the only reliable way of retrieving proc addresses. - Check if ogl_LoadFunctions failed and make OpenGLSWFrameBuffer gracefully recover from that --- src/gl/system/gl_load.c | 4 +++- src/gl/system/gl_swframebuffer.cpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gl/system/gl_load.c b/src/gl/system/gl_load.c index 7075d6969..b0608ecb5 100644 --- a/src/gl/system/gl_load.c +++ b/src/gl/system/gl_load.c @@ -85,7 +85,9 @@ static PROC WinGetProcAddress(const char *name) #define IntGetProcAddress(name) AppleGLGetProcAddress(name) #else #if defined(__sgi) || defined(__sun) || defined(__unix__) - #define IntGetProcAddress(name) PosixGetProcAddress((const GLubyte*)name) + void* SDL_GL_GetProcAddress(const char* proc); + #define IntGetProcAddress(name) SDL_GL_GetProcAddress((const char*)name) + //#define IntGetProcAddress(name) PosixGetProcAddress((const GLubyte*)name) /* END OF MANUAL CHANGES, DO NOT REMOVE! */ #else /* GLX */ #include diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index ee5c0d58d..16138585d 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -194,7 +194,11 @@ OpenGLSWFrameBuffer::OpenGLSWFrameBuffer(void *hMonitor, int width, int height, static bool first = true; if (first) { - ogl_LoadFunctions(); + if (ogl_LoadFunctions() == ogl_LOAD_FAILED) + { + Printf("OpenGL load failed. No OpenGL acceleration will be used.\n"); + return; + } } gl_LoadExtensions(); InitializeState();