summaryrefslogtreecommitdiff
path: root/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-05-30 20:20:47 +0000
committerManolo Gouy <Manolo>2018-05-30 20:20:47 +0000
commitf3971319b9de0c52eaf8055e18bf02321440de1d (patch)
tree1bd4c60ff25133194ce01e2afaa3c93650316b22 /src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
parent8ef4035b6da95acecbda10b7a9f7d3f93d2389b7 (diff)
MacOS: have Fl_OpenGL_Display_Device::capture_gl_rectangle() capture also the overlay of GL windows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12938 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx')
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
index 09d02cbc3..781e3be6e 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Display_Device.cxx
@@ -38,6 +38,7 @@ Fl_OpenGL_Display_Device::Fl_OpenGL_Display_Device(Fl_OpenGL_Graphics_Driver *gr
}
#ifdef FL_CFG_GFX_QUARTZ
+#include <FL/Fl_Gl_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)
@@ -67,7 +68,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;
}
- glw->flush(); // forces a GL redraw, necessary for the glpuzzle demo
+ Fl_Cocoa_Gl_Window_Driver *driver = (Fl_Cocoa_Gl_Window_Driver*)glw->gl_driver();
+ driver->flush_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);
@@ -85,6 +87,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;
+ driver->flush_context();
return img;
}