From b6722b838762b7cca15dda5ecc0370f023e6ff02 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 22 Oct 2010 16:41:15 +0000
Subject: [PATCH] fix crash on mac

---
 utils/api_demos/mainGlut.cpp | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/utils/api_demos/mainGlut.cpp b/utils/api_demos/mainGlut.cpp
index a0c1276e10..e7011fa846 100644
--- a/utils/api_demos/mainGlut.cpp
+++ b/utils/api_demos/mainGlut.cpp
@@ -427,6 +427,9 @@ int main(int argc, char **argv)
   } 
 
   for(int i = 1; i < argc; i++) GmshMergeFile(argv[i]);
+
+  camera.lookAtCg();
+
   ctx = new drawContext();
   drawContext::setGlobal(new drawContextGlut);
   
@@ -438,14 +441,11 @@ int main(int argc, char **argv)
   else  {   
     glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
   }
-  glutDisplayFunc(display);
   glutInitWindowSize(ctx->viewport[2], ctx->viewport[3]);
   glutInitWindowPosition(400,10);
   glutInitWindowSize(800,800); 
   glutCreateWindow("GLUT Gmsh Viewer"); 
-  
-  camera.lookAtCg();
-  
+  glutDisplayFunc(display);  
   glutReshapeFunc(reshape);
   glutKeyboardFunc(keyboard);
   glutMotionFunc(motion);
@@ -453,7 +453,6 @@ int main(int argc, char **argv)
   glutKeyboardFunc(processNormalKeys);
   glutSpecialFunc(processSpecialKeys);	
 
-
   cout<<"-------------------------------------"<<endl;
   cout<<"          SHORTCUTS "<<endl;
   cout<<"-------------------------------------"<<endl;
@@ -480,6 +479,3 @@ int main(int argc, char **argv)
   GmshFinalize();
   return 0;
 }
-
-
- 
-- 
GitLab