From 785234322b3ce793cdb9f2f1fad283396954f618 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 30 Nov 2010 16:40:24 +0000
Subject: [PATCH] fix win32 compile

---
 Fltk/openglWindow.cpp          | 10 +++++-----
 Graphics/Camera.cpp            | 12 ++++++------
 Graphics/Camera.h              | 13 +------------
 utils/api_demos/CMakeLists.txt |  2 +-
 4 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp
index 5d7916f73b..82a734a0db 100644
--- a/Fltk/openglWindow.cpp
+++ b/Fltk/openglWindow.cpp
@@ -205,7 +205,7 @@ void openglWindow::draw()
       cam->giveViewportDimension(_ctx->viewport[2],_ctx->viewport[3]);  
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
-      glFrustum(cam->glFleft,cam->glFright,cam->glFbottom,cam->glFtop,cam->near,cam->far); 
+      glFrustum(cam->glFleft,cam->glFright,cam->glFbottom,cam->glFtop,cam->glFnear,cam->glFfar); 
       glMatrixMode(GL_MODELVIEW);
       glLoadIdentity();
       glDrawBuffer(GL_BACK);
@@ -240,7 +240,7 @@ void openglWindow::draw()
       double right =   cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl;
       double top    =   cam->wd2;
       double  bottom = - cam->wd2;
-      glFrustum(left,right,bottom,top,cam->near,cam->far);
+      glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar);
       glMatrixMode(GL_MODELVIEW);
       glLoadIdentity();
       gluLookAt(cam->position.x+eye.x, cam->position.y+eye.y,  cam->position.z+eye.z,
@@ -258,7 +258,7 @@ void openglWindow::draw()
       right =   cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl;
       top    =   cam->wd2;
       bottom = - cam->wd2;
-      glFrustum(left,right,bottom,top,cam->near,cam->far);
+      glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar);
       glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_TRUE);
       glMatrixMode(GL_MODELVIEW);
       glLoadIdentity();
@@ -281,7 +281,7 @@ void openglWindow::draw()
     double right =   cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl;
     double top    =   cam->wd2;
     double  bottom = - cam->wd2;
-    glFrustum(left,right,bottom,top,cam->near,cam->far);
+    glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar);
     glMatrixMode(GL_MODELVIEW);
     glDrawBuffer(GL_BACK_RIGHT);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -299,7 +299,7 @@ void openglWindow::draw()
     right =   cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl;
     top    =   cam->wd2;
     bottom = - cam->wd2;
-    glFrustum(left,right,bottom,top,cam->near,cam->far);
+    glFrustum(left,right,bottom,top,cam->glFnear,cam->glFfar);
     
     glMatrixMode(GL_MODELVIEW);
     glDrawBuffer(GL_BACK_LEFT);
diff --git a/Graphics/Camera.cpp b/Graphics/Camera.cpp
index 4ac6d5cf35..82504520bf 100644
--- a/Graphics/Camera.cpp
+++ b/Graphics/Camera.cpp
@@ -23,8 +23,8 @@ Camera::~Camera(){};
 
 void Camera::init(){
   on=true;  
-  near=0.1 ; 
-  far=10000;
+  glFnear=0.1 ; 
+  glFfar=10000;
   eye_sep_ratio=.015;
   // apparent angle of the screen height
   aperture = 25;
@@ -102,8 +102,8 @@ void Camera::update() {
   normalize(right);
   normalize(view);
   radians =  0.0174532925 * aperture / 2.;
-  wd2 = near * tan(radians);
-  ndfl    = near / focallength;
+  wd2 = glFnear * tan(radians);
+  ndfl    = glFnear / focallength;
 }
 
 
@@ -128,8 +128,8 @@ void Camera::affiche() {
   cout<<"  Lc "<< Lc<<endl;
   cout<<"  eye_sep_ratio "<<eye_sep_ratio <<endl;
   cout<<"  closeness "<< closeness<<endl;
-  cout<<"  near "<< near <<endl; 
-  cout<<"  far "<<far <<endl;
+  cout<<"  glFnear "<< glFnear <<endl; 
+  cout<<"  glFfar "<< glFfar <<endl;
   cout<<"  radians "<<radians <<endl;
   cout<<"  wd2 "<<wd2 <<endl;
 }
diff --git a/Graphics/Camera.h b/Graphics/Camera.h
index 27854c074a..adf77eec90 100644
--- a/Graphics/Camera.h
+++ b/Graphics/Camera.h
@@ -45,17 +45,6 @@ Quaternion mult(const Quaternion& A,const Quaternion& B);
 Quaternion operator *(const Quaternion &A, const Quaternion &B);
 
 
-
-
-
-
-
-
-
-
-
-
-
 using namespace std; 
 
 class Camera {
@@ -73,7 +62,7 @@ public:
   double screenratio, distance, ref_distance;
   bool button_left_down, button_middle_down, button_right_down;
   bool stereoEnable;
-  double Lc, eye_sep_ratio, closeness, near , ndfl, far, radians,wd2 ;
+  double Lc, eye_sep_ratio, closeness, ndfl, glFnear, glFfar, radians, wd2;
   double glFleft,glFright,glFtop,glFbottom;
   Camera():stereoEnable(false),on(false){};
   ~Camera();
diff --git a/utils/api_demos/CMakeLists.txt b/utils/api_demos/CMakeLists.txt
index f6ab8ed2f0..15193579eb 100644
--- a/utils/api_demos/CMakeLists.txt
+++ b/utils/api_demos/CMakeLists.txt
@@ -34,7 +34,7 @@ add_executable(mainElasticity mainElasticity.cpp)
 target_link_libraries(mainElasticity shared)
 
 add_executable(mainGlut mainGlut.cpp)
-target_link_libraries(mainGlut shared ${glut})
+target_link_libraries(mainGlut lib ${GMSH_EXTERNAL_LIBRARIES} ${glut})
 
 add_executable(mainHomology mainHomology.cpp)
 target_link_libraries(mainHomology shared)
-- 
GitLab