diff options
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/context_gl_x11.cpp | 23 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 2 | ||||
-rw-r--r-- | platform/x11/platform_config.h | 3 |
3 files changed, 23 insertions, 5 deletions
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index ccf7a801ef..789f346608 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -76,6 +76,13 @@ static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) { }*/ +static bool ctxErrorOccurred = false; +static int ctxErrorHandler( Display *dpy, XErrorEvent *ev ) +{ + ctxErrorOccurred = true; + return 0; +} + Error ContextGL_X11::initialize() { @@ -133,21 +140,31 @@ Error ContextGL_X11::initialize() { //}; + int (*oldHandler)(Display*, XErrorEvent*) = + XSetErrorHandler(&ctxErrorHandler); + + if (!opengl_3_context) { //oldstyle context: p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE); } else { static int context_attribs[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, 3, - GLX_CONTEXT_MINOR_VERSION_ARB, 0, - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, + GLX_CONTEXT_MINOR_VERSION_ARB, 3, + GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB|GLX_CONTEXT_DEBUG_BIT_ARB, None }; p->glx_context = glXCreateContextAttribsARB(x11_display, fbc[0], NULL, true, context_attribs); - ERR_FAIL_COND_V(!p->glx_context,ERR_UNCONFIGURED); + ERR_EXPLAIN("Could not obtain an OpenGL 3.3 context!"); + ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context,ERR_UNCONFIGURED); } + XSync( x11_display, False ); + XSetErrorHandler( oldHandler ); + + print_line("ALL IS GOOD"); + glXMakeCurrent(x11_display, x11_window, p->glx_context); /* diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d2d6e88c4b..581a930143 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -204,7 +204,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) - context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, false ) ); + context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, true ) ); context_gl->initialize(); RasterizerGLES3::register_config(); diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h index 1873e712ec..4d31f87820 100644 --- a/platform/x11/platform_config.h +++ b/platform/x11/platform_config.h @@ -35,6 +35,7 @@ #endif #define GLES2_INCLUDE_H "gl_context/GL/glew.h" -#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +//#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/glad/glad.h" |