[vtkusers] The vtkRenderWindow don't render stereo mode for Crystal eyes.

林 信介 savage_cin29 at hotmail.com
Wed Oct 20 04:53:23 EDT 2010


Dear all :
       
 
    OS : windows 7 64bit
    VTK: 5.6 Version
    Display Card : Quadro FX 570
    Monitor : ASUS VG 236 H with NVIDIA 3D VISION KIT
 
    I code a stereo test program using VC2008. The following is my code.
 
    //---------------------------------------------------------------------------------------------------------------
    vtkVolume16Reader *v16 =  vtkVolume16Reader::New();
    v16->SetDataDimensions( 64, 64);
    v16->SetDataByteOrderToLittleEndian();
    v16->SetImageRange( 1, 93);
    v16->SetDataSpacing( 3.2, 3.2, 1.5);
    v16->SetFilePrefix( "C:\\VTKData5.6\\Data\\headsq\\quarter" );
    v16->SetFilePattern("%s.%d");
    v16->SetDataMask( 0x7fff);
    v16->Update();
 
    vtkContourFilter *contour = vtkContourFilter::New();
    contour->SetInputConnection(v16->GetOutputPort());
    contour->SetValue(0,1500);
    contour->SetValue(1,2500);
 
    vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
    skinNormals->SetInputConnection(contour->GetOutputPort());
    skinNormals->SetFeatureAngle(60.0);
  
    vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
    skinMapper->SetInputConnection(skinNormals->GetOutputPort());
    skinMapper->ScalarVisibilityOff();
  
    vtkActor *skin = vtkActor::New();
    skin->SetMapper(skinMapper);
 
    vtkRenderer *renderer = vtkRenderer::New();
    renderer->AddActor(skin);
    renderer->SetBackground(0,0,0);
 
    vtkRenderWindow *renWin = vtkRenderWindow::New();
    renWin->AddRenderer(renderer);
    renWin->SetStereoCapableWindow(1);
    renWin->StereoRenderOn();
    renWin->SetStereoTypeToCrystalEyes();
    renWin->StereoUpdate();
 
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);
 
    iren->Initialize();
    iren->Start();
   //---------------------------------------------------------------------------------------------------------------
 
   The above code can render 3D image for Crystal eyes correctly. 
   However, when i use the same code on Borland C++ Builder, the stereo mode don't work.
   I use ComboBox to select the stereo mode dynamically.
   The effect work well except the crystal eyes.
   This is my event code for ComboBox.
 
   //---------------------------------------------------------------------------------------------------------------
   void __fastcall TForm1::ComboBox1Change(TObject *Sender)
   {
        TComboBox *cb = dynamic_cast<TComboBox *>(Sender);
        
        // The following code is essential. Because the stereo capable window must "ON" before the "the render window" rendered.
        vtkWindow->GetRenderWindow()->Finalize();
        vtkWindow->GetRenderWindow()->SetStereoCapableWindow(1);
        vtkWindow->GetRenderWindow()->StereoRenderOn();
 
        switch (cb->ItemIndex) {
        case 0:
              vtkWindow->GetRenderWindow()->SetStereoTypeToDresden();
        break;
        case 1:
              vtkWindow->GetRenderWindow()->SetStereoTypeToCheckerboard();
        break;
        case 2:
              vtkWindow->GetRenderWindow()->SetStereoTypeToInterlaced();
        break;
        case 3:
             vtkWindow->GetRenderWindow()->SetStereoTypeToAnaglyph();
        break;
        case 4:
             vtkWindow->GetRenderWindow()->SetStereoTypeToRedBlue();
        break;
         case 5:
             vtkWindow->GetRenderWindow()->SetStereoTypeToCrystalEyes();
         break;
         case 6:
             vtkWindow->GetRenderWindow()->SetStereoTypeToLeft();
         break;
         case 7:
            vtkWindow->GetRenderWindow()->SetStereoTypeToRight();
         break;
         default:
         break;
         }
 
 // My function to refresh vtkBorlandRenderWindow
 winRefresh();
 }
 //---------------------------------------------------------------------------------------------------------------
 
 
Does anyone meet the problem? How to resolve the problem??
Thanks
 
 
 
 
Wallance Lin
  		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101020/5921ab1a/attachment.htm>


More information about the vtkusers mailing list