Index: /trunk/source/visualization/OpenGL/GNUmakefile
===================================================================
--- /trunk/source/visualization/OpenGL/GNUmakefile	(revision 1232)
+++ /trunk/source/visualization/OpenGL/GNUmakefile	(revision 1233)
@@ -11,5 +11,5 @@
 
 # For debug mode
-# CPPFLAGS += -DG4DEBUG_VIS_OGL
+ CPPFLAGS += -DG4DEBUG_VIS_OGL
 
 GLOBLIBS  = libG4vis_management.lib libG4modeling.lib libG4gl2ps.lib
Index: /trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc
===================================================================
--- /trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 1232)
+++ /trunk/source/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc	(revision 1233)
@@ -67,11 +67,29 @@
 #endif
   fReadyToPaint = false;
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::Initialise VVVVVVVVVVVVVVVV \n");
+#endif
   CreateMainWindow (this,QString(fName));
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::Initialise ^^^^^^^^^^^^^^^^\n");
+#endif
   CreateFontLists ();
 
   fReadyToPaint = true;
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::InitialiseGLView * \n");
+#endif
+
+  // L.Garnier 01/2010 Force a update in order to Init GL
+  //  updateGL();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::InitialiseGLView end * \n");
+#endif
 }
 
 void G4OpenGLImmediateQtViewer::initializeGL () {
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLImmediateQtViewer::InitialiseGL * \n");
+#endif
 
   InitializeGLView ();
@@ -162,5 +180,5 @@
 {  
 #ifdef G4DEBUG_VIS_OGL
-  printf("\n\nG4OpenGLImmediateQtViewer::resizeGL VVVV\n");
+  printf("\n\nG4OpenGLImmediateQtViewer::resizeGL VVVV recu : W:%d H:%d\n",aWidth,aHeight);
 #endif
   ResizeWindow(aWidth,aHeight);
Index: /trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
===================================================================
--- /trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 1232)
+++ /trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc	(revision 1233)
@@ -111,5 +111,5 @@
 
 #ifdef G4DEBUG_VIS_OGL
-  printf("G4OpenGLQtViewer::CreateMainWindow :: ++++++++++++++ add new TAB %s\n",name.toStdString().c_str());
+  printf("G4OpenGLQtViewer::CreateMainWindow :: ++++++++++++++ add new TAB %s  W:%d H:%d SizeHinX:%d SizeHintY:%d\n",name.toStdString().c_str(),getWinWidth(),getWinHeight(),fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
 #endif
   G4Qt* interactorManager = G4Qt::getInstance ();
@@ -125,7 +125,7 @@
 
   // return false if G4UIQt was not launch
-  bool res = interactorManager->AddTabWidget(fWindow,name,getWinWidth(),getWinHeight());
-
-  if (!res) { // we have to do a dialog
+  bool isTabbedView = interactorManager->AddTabWidget(fWindow,name,getWinWidth(),getWinHeight());
+
+  if (!isTabbedView) { // we have to do a dialog
 
     QWidget *myParent = getParentWidget();
@@ -135,5 +135,5 @@
     if (myParent != NULL) {
 #if QT_VERSION < 0x040000
-      glWindget->reparent(myParent,0,QPoint(0,0));  
+      glWidget->reparent(myParent,0,QPoint(0,0));  
 #else
       glWidget->setParent(myParent);  
@@ -165,12 +165,28 @@
       YPos = offset;
     }
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLQtViewer::CreateMainWindow :: before resizing to %d %d vvvvvvvvvvvvvvvvvvv\n",getWinWidth(), getWinHeight());
+#endif
     fGLWindow->resize(getWinWidth(), getWinHeight());
 #ifdef G4DEBUG_VIS_OGL
-    printf("G4OpenGLQtViewer::CreateMainWindow :: resizing to %d %d \n",getWinWidth(), getWinHeight());
+    printf("G4OpenGLQtViewer::CreateMainWindow :: after resizing to %d %d ^^^^^^^^^^^^^^^^^^^^\n",getWinWidth(), getWinHeight());
 #endif
     fGLWindow->move(fVP.GetWindowAbsoluteLocationHintX(QApplication::desktop()->width()),YPos);
     fGLWindow->show();
-  } else {
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLQtViewer::CreateMainWindow :: after show to %d %d --------------------\n",getWinWidth(), getWinHeight());
+#endif
+  } else {
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLQtViewer::AddTab VVVVVVVVVVVVVV\n");
+#endif
     fGLWindow = fWindow;
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLQtViewer::AddTab ->resize : %d %d\n",getWinWidth(), getWinHeight());
+#endif
+    fGLWindow->resize(getWinWidth(), getWinHeight());
+#ifdef G4DEBUG_VIS_OGL
+    printf("G4OpenGLQtViewer::AddTab ^^^^^^^^^^^^^^\n");
+#endif
   }
 
@@ -180,4 +196,7 @@
     createPopupMenu();
 
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLQtViewer::CreateMainWindow :: END\n");
+#endif
 }
 
Index: /trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
===================================================================
--- /trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc	(revision 1232)
+++ /trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc	(revision 1233)
@@ -119,4 +119,7 @@
   fWinSize_x = fVP.GetWindowSizeHintX();
   fWinSize_y = fVP.GetWindowSizeHintY();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::InitializeGLView to W:%d H:%d pt:%d\n",fWinSize_x,fWinSize_y,this);
+#endif
 }  
 
@@ -150,4 +153,7 @@
     fSizeHasChanged = false;
   }
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::ResizeWindow :W:%d H:%d changed?:%d set:W:%d H:%d pt:%d\n",fWinSize_x,fWinSize_y,fSizeHasChanged,aWidth,aHeight,this);
+#endif
 }
 
@@ -161,20 +167,36 @@
 {
 #ifdef G4DEBUG_VIS_OGL
-  printf("G4OpenGLViewer::ResizeGLView %d %d\n",fWinSize_x,fWinSize_y);
+  printf("G4OpenGLViewer::ResizeGLView %d %d pt:%d\n",fWinSize_x,fWinSize_y,this);
 #endif
   // Check size
   GLint dims[2];
   glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
-  if (fWinSize_x > (unsigned)dims[0]) {
-    G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<dims[0] <<" is resize to "<<  dims[0] << G4endl;
-    fWinSize_x = dims[0];
-  }
-  if (fWinSize_y > (unsigned)dims[1]) {
-    G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<dims[0] <<" is resize to "<<  dims[1] << G4endl;
-    fWinSize_y = dims[1];
+
+  // L.Garnier 01-2010: Some problems with mac 10.6
+  if ((dims[0] !=0 ) && (dims[1] !=0)) {
+
+#ifdef G4DEBUG_VIS_OGL
+    GLenum err = glGetError();
+    if (err != GL_NO_ERROR) {                          \
+      printf("%s: %s at %s:%d\n",                      \
+             __FUNCTION__,                             \
+             gluErrorString(err),                      \
+             __FILE__, __LINE__);                      \
+      printf("G4OpenGLViewer::ResizeGLView ERRRRR\n");
+    }
+    printf("G4OpenGLViewer::ResizeGLView DIM X:%d Y:%d\n",dims[0],dims[1]);
+#endif
+    if (fWinSize_x > (unsigned)dims[0]) {
+      G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<dims[0] <<" is resize to "<<  dims[0] << G4endl;
+      fWinSize_x = dims[0];
+    }
+    if (fWinSize_y > (unsigned)dims[1]) {
+      G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<dims[0] <<" is resize to "<<  dims[1] << G4endl;
+      fWinSize_y = dims[1];
+    }
   }
   GLsizei side = fWinSize_x;
   if (fWinSize_y < fWinSize_x) side = fWinSize_y;
-
+  
   // SPECIAL CASE if fWinSize_x is even (69 for example) 
   // Ex : X: 69 Y: 26
@@ -255,5 +277,11 @@
   
   // FIXME
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::SetView Call ResizeGLView VVVVVV\n");
+#endif
   ResizeGLView();
+#ifdef G4DEBUG_VIS_OGL
+  printf("G4OpenGLViewer::SetView Call ResizeGLView ^^^^^^\n");
+#endif
   //SHOULD SetWindowsSizeHint()...
 
@@ -689,6 +717,10 @@
   GLint dims[2];
   glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
-  if (fPrintSizeX > dims[0]){
-    return dims[0];
+
+  // L.Garnier 01-2010: Some problems with mac 10.6
+  if ((dims[0] !=0 ) && (dims[1] !=0)) {
+    if (fPrintSizeX > dims[0]){
+      return dims[0];
+    }
   }
   if (fPrintSizeX < -1){
@@ -704,6 +736,10 @@
   GLint dims[2];
   glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
-  if (fPrintSizeY > dims[1]){
-    return dims[1];
+
+  // L.Garnier 01-2010: Some problems with mac 10.6
+  if ((dims[0] !=0 ) && (dims[1] !=0)) {
+    if (fPrintSizeY > dims[1]){
+      return dims[1];
+    }
   }
   if (fPrintSizeY < -1){
