[master] 700fb1a - Improve virtual void* Fl_Gl_Window_Driver::GetProcAddress(procName)

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] 700fb1a - Improve virtual void* Fl_Gl_Window_Driver::GetProcAddress(procName) "ManoloFLTK" 00:02 Sep 14 top right image
 
commit 700fb1aadd86f6fc81f4acccfe44dd539f487c57
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Wed Sep 14 08:53:45 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Wed Sep 14 08:53:45 2022 +0200

    Improve virtual void* Fl_Gl_Window_Driver::GetProcAddress(procName)

 src/Fl_Gl_Window.cxx                            | 29 ++++++++++---------------
 src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H   |  1 +
 src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx |  6 +++++
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git src/Fl_Gl_Window.cxx src/Fl_Gl_Window.cxx
index 2842338..7784af9 100644
--- src/Fl_Gl_Window.cxx
+++ src/Fl_Gl_Window.cxx
@@ -521,28 +521,21 @@ char Fl_Gl_Window_Driver::swap_type() {return UNDEFINED;}
 
 
 void* Fl_Gl_Window_Driver::GetProcAddress(const char *procName) {
-#if (HAVE_DLSYM && HAVE_DLFCN_H)
+#if defined(HAVE_GLXGETPROCADDRESSARB)
+  return (void*)glXGetProcAddressARB((const GLubyte *)procName);
+  
+#elif (HAVE_DLSYM && HAVE_DLFCN_H)
+#  ifdef RTLD_DEFAULT
+      void *rtld_default = RTLD_DEFAULT;
+#  else
+      static void *rtld_default = dlopen(0, RTLD_LAZY);
+#  endif
   char symbol[1024];
-
   snprintf(symbol, sizeof(symbol), "_%s", procName);
+  return dlsym(rtld_default, symbol);
 
-#    ifdef RTLD_DEFAULT
-  return dlsym(RTLD_DEFAULT, symbol);
-
-#    else // No RTLD_DEFAULT support, so open the current a.out symbols...
-  static void *rtld_default = dlopen(0, RTLD_LAZY);
-
-  if (rtld_default) return dlsym(rtld_default, symbol);
-  else return 0;
-
-#    endif // RTLD_DEFAULT
-
-#elif defined(HAVE_GLXGETPROCADDRESSARB)
-  return (void*)glXGetProcAddressARB((const GLubyte *)procName);
-
-#else
-  return 0;
 #endif // HAVE_DLSYM
+  return NULL;
 }
 
 Fl_Font_Descriptor** Fl_Gl_Window_Driver::fontnum_to_fontdescriptor(int fnum) {
diff --git src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H
index 9a3d060..1f03321 100644
--- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H
+++ src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.H
@@ -42,6 +42,7 @@ class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver {
   virtual char *alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs);
   virtual Fl_RGB_Image* capture_gl_rectangle(int x, int y, int w, int h);
   virtual bool need_scissor() { return true; }
+  virtual void* GetProcAddress(const char *procName);
   void apply_scissor();
 };
 
diff --git src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx
index a77ff77..4d47c30 100644
--- src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx
+++ src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.cxx
@@ -25,6 +25,7 @@
 #include <FL/Fl_Graphics_Driver.H>
 #include <OpenGL/OpenGL.h>
 #include <FL/Fl_Image_Surface.H>
+#include <dlfcn.h>
 
 extern void gl_texture_reset();
 
@@ -293,6 +294,11 @@ Fl_RGB_Image* Fl_Cocoa_Gl_Window_Driver::capture_gl_rectangle(int x, int y, int
 }
 
 
+void* Fl_Cocoa_Gl_Window_Driver::GetProcAddress(const char *procName) {
+  return dlsym(RTLD_DEFAULT, procName);
+}
+
+
 FL_EXPORT NSOpenGLContext *fl_mac_glcontext(GLContext rc) {
   return (NSOpenGLContext*)rc;
 }
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]Next Message ]
 
 

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