From 0fdc88d2d7b55c0d90a138117b90c798901366a7 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 23 Sep 2022 18:09:40 +0200 Subject: GL3 support under X11: ask for compatibility profile if possible. --- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/drivers/X11') diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index 597801a0f..476d654f3 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx @@ -278,7 +278,7 @@ GLContext Fl_X11_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 2, //GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, - //GLX_CONTEXT_PROFILE_MASK_ARB , GLX_CONTEXT_CORE_PROFILE_BIT_ARB, + GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, None }; ctxErrorOccurred = false; @@ -286,6 +286,12 @@ GLContext Fl_X11_Gl_Window_Driver::create_gl_context(Fl_Window* window, const Fl ctx = glXCreateContextAttribsARB(fl_display, ((Fl_X11_Gl_Choice*)g)->best_fb, shared_ctx, true, context_attribs); XSync(fl_display, false); // Sync to ensure any errors generated are processed. if (ctxErrorOccurred) ctx = 0; + if (!ctx) { // if did not work, try again asking for core profile + ctxErrorOccurred = false; + context_attribs[5] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + ctx = glXCreateContextAttribsARB(fl_display, ((Fl_X11_Gl_Choice*)g)->best_fb, shared_ctx, true, context_attribs); + if (ctxErrorOccurred) ctx = 0; + } XSetErrorHandler(oldHandler); } if (!ctx) { // use OpenGL 1-style context creation -- cgit v1.2.3