From 2ce62b2acec86dc99283f0950c9e6e636e046a28 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 20 Nov 2010 10:26:47 +0000
Subject: [PATCH] more tweaks for 64 bit mac version

---
 Fltk/FlGui.cpp           |  8 --------
 Graphics/drawContext.cpp | 10 ++++++++++
 Graphics/drawPost.cpp    | 10 ++++++++--
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp
index f99de795ba..7fc4630808 100644
--- a/Fltk/FlGui.cpp
+++ b/Fltk/FlGui.cpp
@@ -185,14 +185,6 @@ FlGui::FlGui(int argc, char **argv)
   // set default font size
   FL_NORMAL_SIZE = drawContext::global()->getFontSize();
 
-#if defined(__APPLE__) && defined(HAVE_64BIT_SIZE_T)
-#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3)
-  int numStrings = 1000;
-  if(gl_texture_pile_height() < numStrings)
-    gl_texture_pile_height(numStrings);
-#endif
-#endif
-
   // handle themes and tooltip font size
   if(CTX::instance()->guiTheme.size())
     Fl::scheme(CTX::instance()->guiTheme.c_str());
diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp
index d79f3c17c8..903f666e1e 100644
--- a/Graphics/drawContext.cpp
+++ b/Graphics/drawContext.cpp
@@ -21,6 +21,7 @@
 #if defined(HAVE_FLTK)
 #include <FL/Fl_JPEG_Image.H>
 #include <FL/Fl_PNG_Image.H>
+#include <FL/gl.h>
 #endif
   
 drawContextGlobal *drawContext::_global = 0;
@@ -252,6 +253,15 @@ void drawContext::draw3d()
   else
     CTX::instance()->polygonOffset = 0;
 
+  // speedup drawing of textured fonts on cocoa mac version
+#if defined(HAVE_FLTK) && defined(__APPLE__) && defined(HAVE_64BIT_SIZE_T)
+#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3)
+  int numStrings = GModel::current()->getNumVertices();
+  if(gl_texture_pile_height() < numStrings)
+    gl_texture_pile_height(numStrings);
+#endif
+#endif
+
   glDepthFunc(GL_LESS);
   glEnable(GL_DEPTH_TEST);
   initProjection();
diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp
index 1bbd4faa17..decb6c91b0 100644
--- a/Graphics/drawPost.cpp
+++ b/Graphics/drawPost.cpp
@@ -5,6 +5,7 @@
 
 #include <math.h>
 #include <algorithm>
+#include "GmshConfig.h"
 #include "GmshMessage.h"
 #include "drawContext.h"
 #include "PView.h"
@@ -16,6 +17,11 @@
 #include "Context.h"
 #include "gl2ps.h"
 
+#if defined(HAVE_FLTK)
+#include <FL/Fl.H>
+#include <FL/gl.H>
+#endif
+
 static void drawArrays(drawContext *ctx, PView *p, VertexArray *va, GLint type, 
                        bool useNormalArray)
 {
@@ -273,8 +279,8 @@ static void drawGlyphs(drawContext *ctx, PView *p)
 
   Msg::Debug("drawing extra glyphs (this is slow...)");
 
-  // speed-up string drawing with cocoa fltk
-#if defined(__APPLE__) && defined(HAVE_64BIT_SIZE_T)
+  // speedup drawing of textured fonts on cocoa mac version
+#if defined(HAVE_FLTK) && defined(__APPLE__) && defined(HAVE_64BIT_SIZE_T)
 #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3)
   if(opt->intervalsType == PViewOptions::Numeric){
     int numStrings = 0;
-- 
GitLab