Skip to content

Commit

Permalink
Mac OS X: restored the possibility to set a GL context mode with the
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Sep 7, 2015
1 parent dc01ded commit 34beb4c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Fl_Gl_Window.cxx
Expand Up @@ -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
Expand All @@ -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>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 34beb4c

Please sign in to comment.