diff options
| author | Manolo Gouy <Manolo> | 2015-09-07 05:52:17 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2015-09-07 05:52:17 +0000 |
| commit | 34beb4c4ddb7fcde83cfdc06148c56e59545e140 (patch) | |
| tree | 875b7a728db41bfc859da9bda15dc9a573d659fc /src | |
| parent | dc01deda0019e5af2f76256b36ada4faee34ce86 (diff) | |
Mac OS X: restored the possibility to set a GL context mode with the
Fl_Gl_Window::(const int *a) member function that uses a zero-ending
array of system-dependent attributes.
This procedure failed whenever a double buffer was asked for.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10854 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Gl_Window.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index ad83c6c13..3b92864cc 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -3,7 +3,7 @@ // // OpenGL window code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2015 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -26,6 +26,7 @@ extern int fl_gl_load_plugin; #include "Fl_Gl_Choice.H" #ifdef __APPLE__ #include <FL/gl.h> +#include <OpenGL/OpenGL.h> #endif #include <FL/Fl_Gl_Window.H> #include <stdlib.h> @@ -68,7 +69,16 @@ void Fl_Gl_Window::show() { if (!shown()) { if (!g) { g = Fl_Gl_Choice::find(mode_,alist); - +#if defined(__APPLE__) + if (g && alist) { + // when the mode is set using the system-dependent alist, and if asking for double buffer, + // the FL_DOUBLE flag must be set in the mode_ member variable + const int *a = alist; + while (*a) { + if (*(a++) == kCGLPFADoubleBuffer) mode_ |= FL_DOUBLE; + } + } +#endif if (!g && (mode_ & FL_DOUBLE) == FL_SINGLE) { g = Fl_Gl_Choice::find(mode_ | FL_DOUBLE,alist); if (g) mode_ |= FL_FAKE_SINGLE; |
