diff options
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 16 | ||||
| -rw-r--r-- | src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx | 7 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 7ce5fe6aa..b46a66e9f 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -34,10 +34,14 @@ class Fl_Window; @class CALayer; @class NSCursor; @class FLWindow; +@class NSOpenGLContext; +@class NSOpenGLPixelFormat; #else class CALayer; class NSCursor; class FLWindow; +class NSOpenGLContext; +class NSOpenGLPixelFormat; #endif // __OBJC__ /** @@ -136,10 +140,18 @@ public: virtual void wait_for_expose(); static void draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h); virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data); + + // these functions are OpenGL-related and use objective-c + // they are put here to avoid libfltk_gl dependency in Fl_cocoa.mm + static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window); + static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // uses Objective-c + static void GLcontext_update(NSOpenGLContext*); // uses Objective-c + static void GLcontext_release(NSOpenGLContext*); // uses Objective-c + static void flush_context(NSOpenGLContext*); // uses Objective-c + static void GLcontext_makecurrent(NSOpenGLContext*); // uses Objective-c + static void GL_cleardrawable(void); // uses Objective-c }; - - #endif // FL_COCOA_WINDOW_DRIVER_H // diff --git a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx index a51788018..3035ff94c 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx +++ b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx @@ -39,6 +39,7 @@ Fl_OpenGL_Display_Device::Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *gr #ifdef FL_CFG_GFX_QUARTZ #include "../../Fl_Gl_Window_Driver.H" +#include "../Cocoa/Fl_Cocoa_Window_Driver.H" // convert BGRA to RGB and also exchange top and bottom static uchar *convert_BGRA_to_RGB(uchar *baseAddress, int w, int h, int mByteWidth) @@ -68,8 +69,8 @@ Fl_RGB_Image* Fl_OpenGL_Display_Device::capture_gl_rectangle(Fl_Gl_Window* glw, if (factor != 1) { w *= factor; h *= factor; x *= factor; y *= factor; } - Fl_Cocoa_Gl_Window_Driver::GLcontext_makecurrent(glw->context()); - Fl_Cocoa_Gl_Window_Driver::flush_context(glw->context()); // to capture also the overlay and for directGL demo + Fl_Cocoa_Window_Driver::GLcontext_makecurrent(glw->context()); + Fl_Cocoa_Window_Driver::flush_context(glw->context()); // to capture also the overlay and for directGL demo // Read OpenGL context pixels directly. // For extra safety, save & restore OpenGL states that are changed glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); @@ -87,7 +88,7 @@ Fl_RGB_Image* Fl_OpenGL_Display_Device::capture_gl_rectangle(Fl_Gl_Window* glw, baseAddress = convert_BGRA_to_RGB(baseAddress, w, h, mByteWidth); Fl_RGB_Image *img = new Fl_RGB_Image(baseAddress, w, h, 3, 3 * w); img->alloc_array = 1; - Fl_Cocoa_Gl_Window_Driver::flush_context(glw->context()); + Fl_Cocoa_Window_Driver::flush_context(glw->context()); return img; } |
