]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx
#3350 creaMaracasVisu Bug New Normal - box PlotterViewer Refresh
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxVtk3DBaseView.cxx
index 75d6c1e7a346018d19f30492560f01ee9c6ff113..d9c33391a9cfa152c4fe8de4cbf2998dd762ed02 100644 (file)
@@ -37,18 +37,19 @@ wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent, vtkBaseData* vtkbasedata)
        _configure      = false;
        _aRenderer      = NULL;
        _renWin         = NULL;
-       _aCamera                = NULL;
+       _aCamera        = NULL;
 }
 //-------------------------------------------------------------------
 wxVtk3DBaseView::~wxVtk3DBaseView()
 {
-
        if (_aCamera!=NULL)             { _aCamera              -> Delete(); _aCamera=NULL;}
        if (_aRenderer!=NULL)   { _aRenderer    -> Delete(); _aRenderer=NULL;}
-       if (_renWin!=NULL)              { 
+       if (_renWin!=NULL)              
+       { 
                if(_renWin->GetReferenceCount()==0)
                {
-                       _renWin         -> Delete(); _renWin=NULL;
+                       _renWin->Delete(); 
+                       _renWin=NULL;
                }
        }
 }
@@ -79,16 +80,12 @@ void wxVtk3DBaseView::Refresh()
 // EED 27/05/2013
 void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
 {
-
-      GetRenderer()->ResetCameraClippingRange();
-
+    GetRenderer()->ResetCameraClippingRange();
        if(ext == NULL)
        {
-
                GetRenderer()->ResetCamera ();
                GetCamera()->Dolly(1.2);
-       }else{
-               
+       }else{  
                /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
                double y = (spc[1])*(origin[1]+(double)ext[3]);
                double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
@@ -98,25 +95,22 @@ void wxVtk3DBaseView::ResetCamera(int* ext, double* spc)
                double y1=(spc[1])*((double)ext[3]+origin[1]);
                double z0=(spc[2])*((double)ext[4]+origin[2]);
                double z1=(spc[2])*((double)ext[5]+origin[2]);*/
-               
                double x0=(spc[0])*((double)ext[0]);
                double x1=(spc[0])*((double)ext[1]);
                double y0=(spc[1])*((double)ext[2]);
                double y1=(spc[1])*((double)ext[3]);
                double z0=(spc[2])*((double)ext[4]);
                double z1=(spc[2])*((double)ext[5]);
-
                GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
                //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
                GetCamera()->Dolly(1.5);        
-       }       
+       }// if ext
 }
 
 //-------------------------------------------------------------------
 void wxVtk3DBaseView::SetStereo(int type)
 {
        //EED 02/06/2012  
-       
        if (_renWin!=NULL)
        {
                if (type==0)
@@ -137,7 +131,6 @@ void wxVtk3DBaseView::SetStereo(int type)
                        // VTK_STEREO_ANAGLYPH     7
                        // VTK_STEREO_CHECKERBOARD 8            
                        _renWin->SetStereoType(type);      
-               
                } // if type
        } // _renWin
 }
@@ -152,6 +145,20 @@ void wxVtk3DBaseView::Configure()
                //wxVtkBaseView::Configure();
                _aRenderer      = vtkRenderer::New();
                _renWin         = vtkRenderWindow::New();
+               
+               int supportopengl=_renWin->SupportsOpenGL();
+               printf("EED wxVtk3DBaseView::Configure >>>>> vtkRenderWindow SupportsOpenGL %d\n", supportopengl );
+               printf("EED wxVtk3DBaseView::Configure >>>>> vtkRenderWindow IsDirect       %d\n", _renWin->IsDirect() );
+               if (supportopengl==0)
+               {
+#if defined(_WIN32)
+                       printf("   OpenGL 3 not detected.\n    Try to install opengl drivers or use de opengl-mesa version.\n    Copy from <ProgramsFiles>\\CreaTools\\crea_TPdlls-4.0.0\\bin\\opengl-mesa\n    the file: opengl32.dll\n to    <ProgramsFiles>\\CreaTools\\CreaTools-3.0.0\\bin \n");
+#else
+                       printf("   OpenGL 3 not detected.\n    Try to install opengl drivers or use de opengl-mesa version.\n");
+#endif
+                       exit(0);
+               }
+               
                _renWin->AddRenderer(_aRenderer);
 
                _aRenderer->GradientBackgroundOn();
@@ -200,10 +207,10 @@ void wxVtk3DBaseView::Configure()
                GetCamera()->Roll(180);
                GetCamera()->Yaw(180+30);
                GetCamera()->Pitch(-22);
-
-
+                               
        }
 }
+
 //-------------------------------------------------------------------
 //EED 27 sep 2006
 void wxVtk3DBaseView::GetSpacing(double spc[3])