diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-02-16 09:29:13 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-02-16 09:29:13 +0100 |
| commit | 1adaa3def2138fafd40b9d9df212a068c57cdbf4 (patch) | |
| tree | 0898ea907c763d197d5137dc299eef8005c16de1 /src/Fl_Gl_Window_Driver.H | |
| parent | 1f55bfe65cc8ca6e7b79efad66a7c304a69b12fe (diff) | |
Create classes Fl_XXX_Gl_Window_Driver according to driver model.
Diffstat (limited to 'src/Fl_Gl_Window_Driver.H')
| -rw-r--r-- | src/Fl_Gl_Window_Driver.H | 113 |
1 files changed, 10 insertions, 103 deletions
diff --git a/src/Fl_Gl_Window_Driver.H b/src/Fl_Gl_Window_Driver.H index 94a54b5d0..d2670e2cc 100644 --- a/src/Fl_Gl_Window_Driver.H +++ b/src/Fl_Gl_Window_Driver.H @@ -36,6 +36,14 @@ class Fl_Gl_Window_Driver { protected: Fl_Gl_Window *pWindow; public: + static GLContext cached_context; + static Fl_Window* cached_window; + static int nContext; + static GLContext *context_list; + static Fl_Gl_Choice *first; + static int copy; + static float gl_scale; + static GLContext gl_start_context; Fl_Gl_Choice* g() {return pWindow->g;} void g(Fl_Gl_Choice *c) {pWindow->g = c;} int mode() {return pWindow->mode_;} @@ -62,6 +70,8 @@ public: virtual int flush_begin(char& valid_f) {return 0;} virtual void gl_hide_before(void *& overlay) {} // the default implementation may be enough static Fl_Gl_Choice *find_begin(int m, const int *alistp); + static void add_context(GLContext ctx); + static void del_context(GLContext ctx); // Return one of these structures for a given gl mode. // The second argument is a glX attribute list, and is used if mode is zero. // This is not supported on Win32: @@ -91,109 +101,6 @@ public: virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum); }; -#ifdef FL_CFG_GFX_QUARTZ -#ifdef __OBJC__ -@class NSOpenGLPixelFormat; -#else -class NSOpenGLPixelFormat; -#endif // __OBJC__ - -class Fl_Cocoa_Gl_Window_Driver : public Fl_Gl_Window_Driver { - friend class Fl_Gl_Window_Driver; - friend class Fl_OpenGL_Display_Device; - Fl_Cocoa_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {} - virtual float pixels_per_unit(); - virtual void before_show(int& need_after); - virtual void after_show(); - virtual int mode_(int m, const int *a); - virtual void make_current_before(); - virtual void swap_buffers(); - virtual void resize(int is_a_resize, int w, int h); - virtual char swap_type(); - virtual Fl_Gl_Choice *find(int m, const int *alistp); - virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0); - virtual void set_gl_context(Fl_Window* w, GLContext context); - virtual void delete_gl_context(GLContext); - virtual void make_overlay_current(); - virtual void redraw_overlay(); - virtual void gl_start(); - virtual char *alpha_mask_for_string(const char *str, int n, int w, int h); -}; -#endif // FL_CFG_GFX_QUARTZ - - -#ifdef FL_CFG_GFX_GDI - -class Fl_WinAPI_Gl_Window_Driver : public Fl_Gl_Window_Driver { - friend class Fl_Gl_Window_Driver; - Fl_WinAPI_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {} - virtual float pixels_per_unit(); - virtual int mode_(int m, const int *a); - virtual void make_current_after(); - virtual void swap_buffers(); - virtual void invalidate() {} - virtual int flush_begin(char& valid_f); - virtual Fl_Gl_Choice *find(int m, const int *alistp); - virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0); - virtual void set_gl_context(Fl_Window* w, GLContext context); - virtual void delete_gl_context(GLContext); - virtual void make_overlay_current(); - virtual void redraw_overlay(); - virtual void* GetProcAddress(const char *procName); - virtual void draw_string_legacy(const char* str, int n); - virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize); - virtual void get_list(Fl_Font_Descriptor *fd, int r); - virtual int genlistsize(); -#if HAVE_GL_OVERLAY - virtual void gl_hide_before(void *& overlay); - virtual int can_do_overlay(); - virtual int overlay_color(Fl_Color i); - void make_overlay(void*&overlay); -#endif -}; - -#endif // FL_CFG_GFX_GDI - - -#ifdef FL_CFG_GFX_XLIB -#include <X11/Xutil.h> // for XVisualInfo -class Fl_X11_Gl_Window_Driver : public Fl_Gl_Window_Driver { - friend class Fl_Gl_Window_Driver; - Fl_X11_Gl_Window_Driver(Fl_Gl_Window *win) : Fl_Gl_Window_Driver(win) {} - virtual float pixels_per_unit(); - virtual void before_show(int& need_after); - virtual int mode_(int m, const int *a); - virtual void swap_buffers(); - virtual void resize(int is_a_resize, int w, int h); - virtual char swap_type(); - virtual Fl_Gl_Choice *find(int m, const int *alistp); - virtual GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer = 0); - virtual void set_gl_context(Fl_Window* w, GLContext context); - virtual void delete_gl_context(GLContext); -#if HAVE_GL_OVERLAY - virtual void make_overlay(void *&o); - virtual int can_do_overlay(); - virtual void hide_overlay(); - virtual int overlay_color(Fl_Color i); -#endif - virtual void make_overlay_current(); - virtual void redraw_overlay(); - virtual void waitGL(); - virtual void gl_visual(Fl_Gl_Choice*); // support for Fl::gl_visual() - virtual void gl_start(); - virtual void draw_string_legacy(const char* str, int n); - virtual void gl_bitmap_font(Fl_Font_Descriptor *fl_fontsize); - virtual void get_list(Fl_Font_Descriptor *fd, int r); - virtual int genlistsize(); -#if !USE_XFT - virtual Fl_Font_Descriptor** fontnum_to_fontdescriptor(int fnum); -#endif - public: - static GLContext create_gl_context(XVisualInfo* vis); -}; - -#endif // FL_CFG_GFX_XLIB - #endif /* Fl_Gl_Window_Driver_H */ /** |
