FLTK logo

[master] 0fdc88d - GL3 support under X11: ask for compatibility profile if possible.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 0fdc88d - GL3 support under X11: ask for compatibility profile if possible. "ManoloFLTK" Sep 23, 2022  
 
commit 0fdc88d2d7b55c0d90a138117b90c798901366a7
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Sep 23 18:09:40 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Sep 23 18:09:40 2022 +0200

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

diff --git src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
index 597801a..476d654 100644
--- src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx
+++ 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
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.