diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 669a667671954c73e17afaaa37bd0cc09931ff9f..c13ac7d76a616b6efb3325a303d3b1bb60828aa0 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -952,12 +952,14 @@ void GetOptions(int argc, char *argv[])
         i++;
       }
       else if(!strcmp(argv[i] + 1, "camera")) {
-        CTX::instance()->camera = 1;
+        opt_general_camera_mode(0, GMSH_SET, 1.);
+	//        CTX::instance()->camera = 1;
         i++;
       }
       else if(!strcmp(argv[i] + 1, "stereo")) {
-        CTX::instance()->camera = 1;
-	CTX::instance()->stereo = 1;
+        opt_general_stereo_mode(0, GMSH_SET, 1.);
+	//        CTX::instance()->camera = 1;
+	//	CTX::instance()->stereo = 1;
         i++;
       }
       else if(!strcmp(argv[i] + 1, "gamepad")) {
diff --git a/Common/Context.cpp b/Common/Context.cpp
index 8ad101fdc44389af17ae90ad02793c04012d1a9a..a01f59324739fc156a4da29dc9056c408c091be2 100644
--- a/Common/Context.cpp
+++ b/Common/Context.cpp
@@ -14,7 +14,7 @@
 #include <FL/Fl.H>
 #endif
 
-CTX::CTX()
+CTX::CTX() : gamepad(0)
 {
   // initialize everything that has no default value in DefaultOptions.h
   short int word = 0x0001;
diff --git a/Common/Context.h b/Common/Context.h
index 10acb383d251be063b1241c9b27dfad737ac3dbc..04ca41b24affa2c32c496a38c3eec5c2e36127e0 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -131,7 +131,7 @@ class CTX {
   double displayBorderFactor;
   // do or do not use the trackball for rotations
   int useTrackball, trackballHyperbolicSheet;
-  // use gamepad controller?
+  // gamepad controller
   GamePad *gamepad;
   // point around which to rotate the scene
   double rotationCenter[3];
diff --git a/Common/GamePad.cpp b/Common/GamePad.cpp
index ae5f5ceb4f5a87a9bf4ad9f7924750162b2a6fc6..88c8274d223c3a8c31a852078142273d6c3919c1 100644
--- a/Common/GamePad.cpp
+++ b/Common/GamePad.cpp
@@ -118,26 +118,31 @@ GamePad::GamePad() : active(false), frequency(.01), gamepad_fd(0)
     active = true;
   }
 #endif
-
-  for (int i = 0; i < std::min(9, (int)buttons); i++) button_map[i] = i;
-  for (int i = 0; i < std::min(7, (int)axes); i++) axe_map[i] = i;
-  axe_map[6]=1;
-  // another recognized map "Thrustmaster Run'N' Drive Wireless PS3"
-  // warning :: on Windows we dont have the human-friendly Model Name of the Gamepad
-  if(strcmp(name, "Thrustmaster Run'N' Drive Wireless PS3") == 0){
-    button_map[0] = 1;
-    button_map[1] = 0;
-    button_map[5] = 6;
-    button_map[6] = 5;
+  if(active){
+    for (int i = 0; i < std::min(9, (int)buttons); i++) {
+      button[i] = false;toggle_status[i] = false;
+    }
+    for (int i = 0; i < std::min(7, (int)axes); i++) axe[i] = 0.;
+    for (int i = 0; i < std::min(9, (int)buttons); i++) button_map[i] = i;
+    for (int i = 0; i < std::min(7, (int)axes); i++) axe_map[i] = i;
+    axe_map[6]=1;
+    // another recognized map "Thrustmaster Run'N' Drive Wireless PS3"
+    // warning :: on Windows we dont have the human-friendly Model Name of the Gamepad
+    if(strcmp(name, "Thrustmaster Run'N' Drive Wireless PS3") == 0){
+      button_map[0] = 1;
+      button_map[1] = 0;
+      button_map[5] = 6;
+      button_map[6] = 5;
+    }
   }
 }
 
 GamePad::~GamePad()
 {
-  active = false;
-  gamepad_fd = 0;
+   active = false;
 #if defined(HAVE_LINUX_JOYSTICK)
-  close(gamepad_fd);
+  if (gamepad_fd)  close(gamepad_fd);
+   gamepad_fd = 0;
 #endif
 }
 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 07ddac3c7fdc3211e6cbddbac18f715fd97cd7ba..4f2ed5356763853c4ab27d0d8649d30052288191 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -3111,11 +3111,16 @@ double opt_general_gamepad(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     if(val){
-      if(!CTX::instance()->gamepad)
+      if(!CTX::instance()->gamepad){
         CTX::instance()->gamepad = new GamePad();
+	if (CTX::instance()->gamepad->active)  opt_general_camera_mode(0, GMSH_SET , 1);
+      }
     }
     else{
-      if(CTX::instance()->gamepad) delete CTX::instance()->gamepad;
+	if(CTX::instance()->gamepad) {
+	  delete CTX::instance()->gamepad;
+	  CTX::instance()->gamepad=0;
+	}
     }
   }
   return CTX::instance()->gamepad ? 1 : 0;
@@ -3159,10 +3164,14 @@ double opt_general_stereo_mode(OPT_ARGS_NUM)
   if(action & GMSH_SET)
     CTX::instance()->stereo = (int)val;
   if (CTX::instance()->stereo)    opt_general_camera_mode(num, action, 1.);
+  
 #if defined(HAVE_FLTK)
+  /*
   if(FlGui::available() && (action & GMSH_GUI))
-    FlGui::instance()->options->general.butt[17]->value(CTX::instance()->stereo);
+  FlGui::instance()->options->general.butt[17]->value(CTX::instance()->stereo);
+*/
 #endif
+  
   return CTX::instance()->stereo ;
 }
 
@@ -3171,9 +3180,11 @@ double opt_general_eye_sep_ratio(OPT_ARGS_NUM)
   if(action & GMSH_SET)
     CTX::instance()->eye_sep_ratio =  (double)val;
 #if defined(HAVE_FLTK)
+  /*
   if(FlGui::available() && (action & GMSH_GUI))
     FlGui::instance()->options->general.value[29]->value
       (CTX::instance()->eye_sep_ratio) ;
+  */
 #endif
   return CTX::instance()->eye_sep_ratio ;
 }
@@ -3182,10 +3193,10 @@ double opt_general_focallength_ratio(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
     CTX::instance()->focallength_ratio = (double) val;
-#if defined(HAVE_FLTK)
+#if defined(HAVE_FLTK)/*
   if(FlGui::available() && (action & GMSH_GUI))
     FlGui::instance()->options->general.value[30]->value
-      (CTX::instance()->focallength_ratio) ;
+    (CTX::instance()->focallength_ratio) ;*/
 #endif
   return CTX::instance()->focallength_ratio ;
 }
@@ -3194,10 +3205,10 @@ double opt_general_camera_aperture(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
     CTX::instance()->camera_aperture = (double)val;
-#if defined(HAVE_FLTK)
+#if defined(HAVE_FLTK)/*
   if(FlGui::available() && (action & GMSH_GUI))
     FlGui::instance()->options->general.value[31]->value
-      (CTX::instance()->camera_aperture);
+    (CTX::instance()->camera_aperture);*/
 #endif
   return CTX::instance()->camera_aperture;
 }
@@ -3207,11 +3218,14 @@ double opt_general_camera_mode(OPT_ARGS_NUM)
   if(action & GMSH_SET)
     CTX::instance()->camera = (int)val;
 #if defined(HAVE_FLTK)
+  /*
   if(FlGui::available() && (action & GMSH_GUI)){
     FlGui::instance()->options->general.butt[18]->value
       (CTX::instance()->camera);
     FlGui::instance()->options->activate("general_camera");
+  
   }
+  */
 #endif
   return CTX::instance()->camera ;
 }
diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp
index e311edf491e93c910d3b42bcc2a0b668063dad8f..f2939768330fe4293754cdc43aea32780bac19e3 100644
--- a/Fltk/FlGui.cpp
+++ b/Fltk/FlGui.cpp
@@ -202,13 +202,19 @@ static void gmsh_search(Fl_Color col)
 #undef bl
 #undef el
 
-static void gp_handler(void *data)
+// question presence of gamepad every 3. seconds
+static void gamepad_handler(void *data)
 {
-  GamePad *gp_ptr = CTX::instance()->gamepad;
-  gp_ptr->read_event();
-  Fl::add_timeout(gp_ptr->frequency, gp_handler, data);
+  if (CTX::instance()->gamepad && CTX::instance()->gamepad->active) {
+    CTX::instance()->gamepad->read_event();
+    Fl::add_timeout(CTX::instance()->gamepad->frequency, gamepad_handler, data);
+  }
+  else{
+    Fl::add_timeout(.5, gamepad_handler, data);
+  }
 }
 
+
 FlGui::FlGui(int argc, char **argv)
 {
   // set X display
@@ -226,11 +232,7 @@ FlGui::FlGui(int argc, char **argv)
   Fl::set_boxtype(GMSH_SIMPLE_RIGHT_BOX, simple_right_box_draw, 0, 0, 1, 0);
   Fl::set_boxtype(GMSH_SIMPLE_TOP_BOX, simple_top_box_draw, 0, 1, 0, 1);
 
-  // add external reader for gamepad events
-  if(CTX::instance()->gamepad && CTX::instance()->gamepad->active){
-    CTX::instance()->camera = 1;
-    Fl::add_timeout(CTX::instance()->gamepad->frequency, gp_handler, (void*)0);
-  }
+  if(CTX::instance()->gamepad)   Fl::add_timeout(5.,gamepad_handler , (void*)0);
 
   // add global shortcuts
   Fl::add_handler(globalShortcut);
diff --git a/Fltk/gamepadWindow.cpp b/Fltk/gamepadWindow.cpp
index 8dee7f9d61f0b93109bfe959ab08319516d8203e..d4614b5d86bf78a4f92b1b88271457733cfe8f6e 100644
--- a/Fltk/gamepadWindow.cpp
+++ b/Fltk/gamepadWindow.cpp
@@ -11,9 +11,6 @@ typedef unsigned long intptr_t;
 #endif
 #include <string.h>
 #include <FL/Fl.H>
-#include <FL/fl_ask.H>
-#include "GmshDefines.h"
-#include "GmshMessage.h"
 #include "FlGui.h"
 #include "paletteWindow.h"
 #include "optionWindow.h"
@@ -53,8 +50,7 @@ gamepadWindow::gamepadWindow()
   int width = 34 * FL_NORMAL_SIZE + WB;
   int height = 15 * BH + 4 * WB;
   int L =  FL_NORMAL_SIZE;
-  //  int BW = width - 4 * WB;
-
+ 
   win = new paletteWindow
     (width, height, CTX::instance()->nonModalWindows ? true : false);
   win->box(GMSH_WINDOW_BOX);
@@ -92,39 +88,38 @@ gamepadWindow::gamepadWindow()
   gamepad.axe[8] = new Fl_Check_Button(L +8*BB*.4 , L+3.*BH , BH, WB, "8" );
   for (int i=0; i<9;i++)    gamepad.axe[i]->deactivate();
 
-  Fl_Box *btt1 = new Fl_Box(FL_NO_BOX, L , L+4.*BH , IW, BH, "Preferences:");
+  Fl_Box *btt1 = new Fl_Box(FL_NO_BOX, L , L+3.7*BH , IW, BH, "Preferences:");
   btt1->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT);
-  Fl_Box *btt2 = new Fl_Box(FL_NO_BOX, L , L+5.*BH , IW, BH, "Action Axes:");
+  Fl_Box *btt2 = new Fl_Box(FL_NO_BOX, L , L+4.7*BH , IW, BH, "Action Axes:");
   btt2->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT);
-  Fl_Box *btt3 = new Fl_Box(FL_NO_BOX, L +width/2, L+5.*BH , IW, BH, "Action buttons:");
+  Fl_Box *btt3 = new Fl_Box(FL_NO_BOX, L +width/2+BH/2, L+4.7*BH , IW, BH, "Action buttons:");
   btt3->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT);
 
   GamePad* pad = CTX::instance()->gamepad;
 
-  gamepad.mapping[0] = new Fl_Value_Input( L+width/2, L+6.*BH , IW/5,BH, "1:1");
-  gamepad.mapping[1] = new Fl_Value_Input( L+width/2, L+7.*BH , IW/5,BH, "permute axes");
-  gamepad.mapping[2] = new Fl_Value_Input( L+width/2, L+8.*BH , IW/5,BH, "reset/invers up axis");
-  gamepad.mapping[3] = new Fl_Value_Input( L+width/2, L+9.*BH , IW/5,BH, "change nav-mode");
-  gamepad.mapping[4] = new Fl_Value_Input( L+width/2, L+10.*BH, IW/5,BH, "move head (with axes)");
-  gamepad.mapping[5] = new Fl_Value_Input( L+width/2, L+11.*BH, IW/5,BH, " ");
-  gamepad.mapping[6] = new Fl_Value_Input( L+width/2, L+12.*BH, IW/5,BH, "walk / swimm");
-  gamepad.mapping[7] = new Fl_Value_Input( L+width/2, L+13.*BH, IW/5,BH, " ");
-  gamepad.mapping[8] = new Fl_Value_Input( L+width/2, L+14.*BH, IW/5,BH, "1:1 ; reset speed");
+  gamepad.mapping[0] = new Fl_Value_Input( L+width/2+BH/2, L+5.7*BH , IW/5,BH, "1:1");
+  gamepad.mapping[1] = new Fl_Value_Input( L+width/2+BH/2, L+6.7*BH , IW/5,BH, "permute axes");
+  gamepad.mapping[2] = new Fl_Value_Input( L+width/2+BH/2, L+7.7*BH , IW/5,BH, "reset/invers up axis");
+  gamepad.mapping[3] = new Fl_Value_Input( L+width/2+BH/2, L+8.7*BH , IW/5,BH, "change nav-mode");
+  gamepad.mapping[4] = new Fl_Value_Input( L+width/2+BH/2, L+9.7*BH, IW/5,BH, "(*) move head");
+  gamepad.mapping[5] = new Fl_Value_Input( L+width/2+BH/2, L+10.7*BH, IW/5,BH, " ");
+  gamepad.mapping[6] = new Fl_Value_Input( L+width/2+BH/2, L+11.7*BH, IW/5,BH, "walk / swimm");
+  gamepad.mapping[7] = new Fl_Value_Input( L+width/2+BH/2, L+12.7*BH, IW/5,BH, " ");
+  gamepad.mapping[8] = new Fl_Value_Input( L+width/2+BH/2, L+13.7*BH, IW/5,BH, "1:1 ; reset speed");
 
   for (int i=0; i<9;i++) {
-    //    gamepad.mapping[i]->deactivate();
     gamepad.mapping[i]->align(FL_ALIGN_RIGHT);
     gamepad.mapping[i]->callback(gamepad_update_cb);
     gamepad.mapping[i]->value(pad->button_map[i]);
    }
 
-  gamepad.mapping[10] = new Fl_Value_Input( L, L+6.*BH , IW/5, BH, "head right/left (with button)");
-  gamepad.mapping[11] = new Fl_Value_Input( L, L+7.*BH , IW/5, BH, "head up/down (with button)");
-  gamepad.mapping[12] = new Fl_Value_Input( L, L+8.*BH , IW/5, BH, "turn left/right");
-  gamepad.mapping[13] = new Fl_Value_Input( L, L+9.*BH, IW/5, BH, "for/backward or up/down ");
-  gamepad.mapping[14] = new Fl_Value_Input( L, L+10.*BH, IW/5, BH, "move aside left/right");
-  gamepad.mapping[15] = new Fl_Value_Input( L, L+11.*BH, IW/5, BH, "move up/down");
-  gamepad.mapping[16] = new Fl_Value_Input( L, L+12.*BH , IW/5, BH, "speed up/slow down");
+  gamepad.mapping[10] = new Fl_Value_Input( L, L+5.7*BH , IW/5, BH, "head right/left with button (*)");
+  gamepad.mapping[11] = new Fl_Value_Input( L, L+6.7*BH , IW/5, BH, "head up/down with button (*)");
+  gamepad.mapping[12] = new Fl_Value_Input( L, L+7.7*BH , IW/5, BH, "turn left/right");
+  gamepad.mapping[13] = new Fl_Value_Input( L, L+8.7*BH, IW/5, BH, "for/backward or up/down ");
+  gamepad.mapping[14] = new Fl_Value_Input( L, L+9.7*BH, IW/5, BH, "move aside left/right");
+  gamepad.mapping[15] = new Fl_Value_Input( L, L+10.7*BH, IW/5, BH, "move up/down");
+  gamepad.mapping[16] = new Fl_Value_Input( L, L+11.7*BH , IW/5, BH, "speed up/slow down");
 
   for (int i=0; i<7;i++) {
     gamepad.mapping[10+i]->align(FL_ALIGN_RIGHT);
diff --git a/Fltk/gamepadWindow.h b/Fltk/gamepadWindow.h
index 39f015a8a9f0e984ece17c4b58347df38b822fbc..8ad6265e2513ca657851538b3fa4ef2354cf7f5c 100644
--- a/Fltk/gamepadWindow.h
+++ b/Fltk/gamepadWindow.h
@@ -7,15 +7,8 @@
 #define _GAMEPAD_WINDOW_H_
 
 #include <FL/Fl_Window.H>
-#include <FL/Fl_Value_Slider.H>
-#include <FL/Fl_Hold_Browser.H>
 #include <FL/Fl_Button.H>
-#include <FL/Fl_Return_Button.H>
 #include <FL/Fl_Check_Button.H>
-#include <FL/Fl_Menu_Button.H>
-#include <FL/Fl_Group.H>
-#include <FL/Fl_Choice.H>
-#include <FL/Fl_Input.H>
 #include <FL/Fl_Value_Input.H>
 #include <FL/Fl_Box.H>
 
diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp
index cb2af287cacbc1ef0646864533d68065a2acf96d..50aa13c22d760067a080090e9ca425e5f2876f47 100644
--- a/Fltk/openglWindow.cpp
+++ b/Fltk/openglWindow.cpp
@@ -22,16 +22,24 @@
 #include "Trackball.h"
 #include "GamePad.h"
 
-// Navigator handler (listen to gamepad or other names pipes)
+// Navigator handler (read gamepad event if gamepad exists or question presence of gamepad)
 static void navigator_handler(void *data)
 {
-  if(CTX::instance()->gamepad && CTX::instance()->gamepad->active){
-    openglWindow* gl_win = (openglWindow*)data;
+  openglWindow* gl_win = (openglWindow*)data;
+  if (CTX::instance()->gamepad && CTX::instance()->gamepad->active) {
+    if (gl_win->Nautilus ==0){
+      gl_win->Nautilus = new Navigator(CTX::instance()->gamepad->frequency,gl_win->getDrawContext());
+    }
     gl_win->moveWithGamepad();
     Fl::add_timeout(CTX::instance()->gamepad->frequency, navigator_handler, data);
   }
+  else{
+    if (gl_win->Nautilus){ delete      gl_win->Nautilus;  gl_win->Nautilus=0; }
+    Fl::add_timeout(3., navigator_handler, data);
+  }
 }
 
+
 static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &click2)
 {
   if(click1.win[0] == click2.win[0] || click1.win[1] == click2.win[1]) return;
@@ -63,10 +71,7 @@ openglWindow::openglWindow(int x, int y, int w, int h)
   addPointMode = lassoMode = selectionMode = false;
   endSelection = undoSelection = invertSelection = quitSelection = 0;
 
-  if(CTX::instance()->gamepad && CTX::instance()->gamepad->active){
-    Nautilus = new Navigator(frequency,_ctx);
-    Fl::add_timeout(CTX::instance()->gamepad->frequency, navigator_handler, (void*)this);
-  }
+  if(CTX::instance()->gamepad)   Fl::add_timeout(.5, navigator_handler, (void*)this);
 }
 
 openglWindow::~openglWindow()
@@ -250,9 +255,8 @@ void openglWindow::draw()
 		cam->up.x,cam->up.y,cam->up.z);
       _ctx->draw3d();
       _ctx->draw2d();
-      if(CTX::instance()->gamepad && CTX::instance()->gamepad->active && Nautilus){
-        Nautilus->drawIcons();
-      }
+      if(CTX::instance()->gamepad && CTX::instance()->gamepad->active && Nautilus) Nautilus->drawIcons();
+     
       _drawScreenMessage();
       _drawBorder();
     }
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 7d9dd53a01668d5a3935952d6f2426e75f83866d..1b268618a33baa369b9dd6f8a39b8a91670f3d8a 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -353,16 +353,31 @@ static void general_options_ok_cb(Fl_Widget *w, void *data)
   opt_general_axes(0, GMSH_SET, o->general.choice[4]->value());
   opt_general_background_gradient(0, GMSH_SET, o->general.choice[5]->value());
 
+  
+  if( (opt_general_gamepad(0, GMSH_GET, 0) !=  o->general.butt[19]->value() ) 
+      || ( opt_general_camera_mode(0, GMSH_GET, 0) !=  o->general.butt[18]->value() )){    
+    if((opt_general_gamepad(0, GMSH_GET, 0) == 1 ) 
+       && (o->general.butt[18]->value() == 0) ) {
+      o->general.butt[19]->value(0) ;
+    }   
+    if((opt_general_camera_mode(0, GMSH_GET, 0) == 0 ) 
+       && ( o->general.butt[19]->value() ==1) ) {
+      o->general.butt[18]->value(1);
+    }
+  }
+  opt_general_gamepad(0, GMSH_SET, o->general.butt[19]->value() );
+  opt_general_camera_mode(0, GMSH_SET, o->general.butt[18]->value());
+  o->activate((const char*)data);
+  
+
   opt_general_eye_sep_ratio(0, GMSH_SET, o->general.value[29]->value());
   opt_general_focallength_ratio(0, GMSH_SET, o->general.value[30]->value());
   opt_general_camera_aperture(0, GMSH_SET, o->general.value[31]->value());
-  opt_general_camera_mode(0, GMSH_SET, o->general.butt[18]->value());
   if(opt_general_stereo_mode(0, GMSH_GET, 0) != o->general.butt[17]->value()) {
     opt_general_stereo_mode(0, GMSH_SET, o->general.butt[17]->value());
-    //    if (CTX::instance()->stereo){
     for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->setStereo((bool)CTX::instance()->stereo);
-    //    }
   }
+  
 
   if(CTX::instance()->fastRedraw)
     CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0;
@@ -1786,11 +1801,13 @@ optionWindow::optionWindow(int deltaFontSize)
       general.butt[18] = new Fl_Check_Button
         (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable camera (experimental)");
       general.butt[18]->type(FL_TOGGLE_BUTTON);
+      general.butt[18]->value(opt_general_camera_mode(0, GMSH_GET, 0));
       general.butt[18]->callback(general_options_ok_cb, (void*)"general_camera");
 
       general.butt[17] = new Fl_Check_Button
         (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Enable stereo rendering (experimental)");
       general.butt[17]->type(FL_TOGGLE_BUTTON);
+      general.butt[17]->value(opt_general_stereo_mode(0, GMSH_GET, 0));
       general.butt[17]->callback(general_options_ok_cb);
 
       general.value[29] = new Fl_Value_Input
@@ -1798,6 +1815,7 @@ optionWindow::optionWindow(int deltaFontSize)
       general.value[29]->minimum(0.1);
       general.value[29]->maximum(10.);
       general.value[29]->step(.1);
+      general.value[29]->value(CTX::instance()->eye_sep_ratio);
       general.value[29]->align(FL_ALIGN_RIGHT);
       general.value[29]->callback(general_options_ok_cb);
 
@@ -1806,6 +1824,7 @@ optionWindow::optionWindow(int deltaFontSize)
       general.value[30]->minimum(0.1);
       general.value[30]->maximum(10.);
       general.value[30]->step(.1);
+      general.value[30]->value(CTX::instance()->focallength_ratio);
       general.value[30]->align(FL_ALIGN_RIGHT);
       general.value[30]->callback(general_options_ok_cb);
 
@@ -1814,21 +1833,39 @@ optionWindow::optionWindow(int deltaFontSize)
       general.value[31]->minimum(10.);
       general.value[31]->maximum(120.);
       general.value[31]->step(1);
+      general.value[31]->value(CTX::instance()->camera_aperture);
       general.value[31]->align(FL_ALIGN_RIGHT);
       general.value[31]->callback(general_options_ok_cb);
 
-      Fl_Button *gmpdcf = new Fl_Button
-        (L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Configure Gamepad");
+      general.butt[19] = new Fl_Check_Button
+        (L + 2 * WB, 2 * WB + 7 * BH, BW, BH , "Enable gamepad (experimental)");
+      general.butt[19]->type(FL_TOGGLE_BUTTON);
+      general.butt[19]->value(opt_general_gamepad(0, GMSH_GET, 0));
+      general.butt[19]->callback(general_options_ok_cb,(void*)"general_camera");
+
+      general.gamepadconfig = new Fl_Button
+        (L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Configure Gamepad");
+      general.gamepadconfig->callback(general_gmpdcf_cb);
 
-      gmpdcf->callback(general_gmpdcf_cb);
-      if(CTX::instance()->gamepad && CTX::instance()->gamepad->active)
-        gmpdcf->activate();
-      else
-        gmpdcf->deactivate();
+  
+      if( opt_general_camera_mode(0, GMSH_GET, 0) == 0 ){
+	general.value[30]->deactivate();
+	general.value[31]->deactivate();
+      }
 
+      if( opt_general_stereo_mode(0, GMSH_GET, 0) == 0 )
+	general.value[29]->deactivate();
+       
+      if(CTX::instance()->gamepad && CTX::instance()->gamepad->active)  {
+	general.gamepadconfig->activate();
+	opt_general_camera_mode(0, GMSH_SET, 1);
+	general.butt[18]->value(opt_general_camera_mode(0, GMSH_GET, 0));
+      }
+      else{
+	general.gamepadconfig->deactivate();
+      }
       o->end();
     }
-    //end of new menu for stereo
     o->end();
   }
 
@@ -3798,19 +3835,31 @@ void optionWindow::activate(const char *what)
     }
   }
   else if(!strcmp(what, "general_camera")){
-    if(general.butt[18]->value()){
-      general.butt[17]->activate();
-      general.value[29]->activate();
-      general.value[30]->activate();
-      general.value[31]->activate();
+    if(general.butt[19]->value()){
+      if(CTX::instance()->gamepad && CTX::instance()->gamepad->active ) general.gamepadconfig->activate();
     }
     else{
-      general.butt[17]->deactivate();
+      general.gamepadconfig->deactivate();
+    }
+   
+    if(general.butt[17]->value()==0){
       general.value[29]->deactivate();
+    }
+    else{
+      general.value[29]->activate();
+    } 
+    
+    if(general.butt[18]->value()==0 ){
       general.value[30]->deactivate();
       general.value[31]->deactivate();
+    } 
+    else{
+      general.value[30]->activate();
+      general.value[31]->activate();   
     }
+    
   }
+   
   else if(!strcmp(what, "geo_transform")){
     if(geo.choice[3]->value() == 1){
       for(int i = 7; i <= 18; i++)
diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h
index 084904a9d28146db70b59842468a07954728be98..f41524e48a9aa10d4e6fce28f60b8b7ead6df05e 100644
--- a/Fltk/optionWindow.h
+++ b/Fltk/optionWindow.h
@@ -39,6 +39,7 @@ class optionWindow{
     Fl_Button *color[50];
     Fl_Input *input[20];
     Fl_Choice *choice[20];
+    Fl_Button *gamepadconfig;
     spherePositionWidget *sphere;
   } general;
   struct{
diff --git a/Graphics/Camera.cpp b/Graphics/Camera.cpp
index 3e57e130a50120137f9a7d5b2fceb4945e1c05c6..9eab2ac68fb04af41796292570802d90fa753d41 100644
--- a/Graphics/Camera.cpp
+++ b/Graphics/Camera.cpp
@@ -17,7 +17,7 @@
 #include "Context.h"
 #include "drawContext.h"
 
-Camera::Camera() : on(false), stereoEnable(false), Lc(1.), glFnear(0.1), glFfar(10000) {}
+Camera::Camera() : on(false), stereoEnable(false), Lc(1.), glFnear(0.0001), glFfar(10000) {}
 
 Camera::~Camera() {}