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
This commit is contained in:
Manolo Gouy 2015-09-07 05:52:17 +00:00
parent dc01deda00
commit 34beb4c4dd

View File

@ -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;