From cace309838b9edaae66e1e8ddfbf60d8c6cf6f23 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 20 Dec 2010 14:48:38 +0000 Subject: [PATCH] Fixed OpenGL overlay drawing (STR #2437). Back-ported the corresponding patch for FLTK 1.3. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@8077 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 1 + src/Fl_Gl_Window.cxx | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index e69fa23fa..a6303bfb9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.1.11 + - Fixed OpenGL overlay drawing (STR #2437) - Fixed Fl_Tabs selection border drawing, if tabs are at the bottom of the widget (part of STR #2480) - Documentation fixes (STR #2410) diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 6a39b0990..588a03196 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -285,10 +285,7 @@ void Fl_Gl_Window::flush() { glDrawBuffer(GL_BACK); if (!SWAP_TYPE) { -#ifdef __APPLE_QD__ - SWAP_TYPE = COPY; -#elif defined __APPLE_QUARTZ__ - // warning: the Quartz version should probably use Core GL (CGL) instead of AGL +#if !defined(WIN32) // __APPLE__ || X11 SWAP_TYPE = COPY; #else SWAP_TYPE = UNDEFINED; @@ -298,6 +295,7 @@ void Fl_Gl_Window::flush() { if (!strcmp(c,"COPY")) SWAP_TYPE = COPY; else if (!strcmp(c, "NODAMAGE")) SWAP_TYPE = NODAMAGE; else if (!strcmp(c, "SWAP")) SWAP_TYPE = SWAP; + else SWAP_TYPE = UNDEFINED; } } @@ -314,6 +312,12 @@ void Fl_Gl_Window::flush() { if (damage() != FL_DAMAGE_OVERLAY || !save_valid) draw(); swap_buffers(); + } else if (SWAP_TYPE == SWAP) { + damage(FL_DAMAGE_ALL); + draw(); + if (overlay == this) draw_overlay(); + swap_buffers(); + } else { // SWAP_TYPE == UNDEFINED // If we are faking the overlay, use CopyPixels to act like @@ -350,7 +354,7 @@ void Fl_Gl_Window::flush() { } - if (overlay==this) { // fake overlay in front buffer + if (overlay==this && SWAP_TYPE != SWAP) { // fake overlay in front buffer glDrawBuffer(GL_FRONT); draw_overlay(); glDrawBuffer(GL_BACK);