From 89f9671b406d1d2ac0377ef90d44ebfa7a92150e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 25 Sep 2022 16:39:40 +0200 Subject: Add cross-platform support for adding widgets to an OpenGL3-based Fl_Gl_Window. Under non-macOS platforms, the key is to call glUseProgram(0); after having used OpenGL 3 which allows to then use OpenGL 1 and draw FLTK widgets over the OpenGL3 scene. Under macOS, this is impossible because macOS GL3 contexts are not compatible with GL1. The solution implemented here is to create an additional Fl_Gl_Window placed above and sized as the GL3-based window, to give it a non opaque, GL1-based context, and to put the FLTK widgets in that additional window. --- FL/mac.H | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'FL') diff --git a/FL/mac.H b/FL/mac.H index 9af98a2e4..d289774f2 100644 --- a/FL/mac.H +++ b/FL/mac.H @@ -153,6 +153,10 @@ extern CGContextRef fl_mac_gc(); extern FLWindow *fl_mac_xid(const Fl_Window *win); /** Returns the Fl_Window corresponding to the given macOS-specific window reference */ extern Fl_Window *fl_mac_find(FLWindow *); +class Fl_Gl_Window; +/** Call this to make possible the addition of FLTK widgets to a GL3-using Fl_Gl_Window. + \see \ref opengl3 */ +extern Fl_Gl_Window *fl_mac_prepare_add_widgets_to_GL3_win(Fl_Gl_Window *); /** The version number of the running Mac OS X (e.g., 100604 for 10.6.4, 101300 for 10.13). FLTK initializes this global variable before main() begins running. If -- cgit v1.2.3