I am trying to do a "Hello World" cone in stereoscopic 3D using VTK (C++) with a GeForce GTX 460 graphics card, NVidia 3D vision glasses and an Asus VG236 Monitor.
<div><br></div><div>I have found fragments of code and have pieced them together but have not had any success in rendering anything in stereo. I am a newbie to VTK, so any help would be greatly appreciated.</div><div><br>
</div><div>Here is what I have thus far:</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace"> /*=========================================================================</font></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; "> Program: Visualization Toolkit</span></div><div><font class="Apple-style-span" face="'courier new', monospace"> Module: $RCSfile: Cone.cxx,v $</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> All rights reserved.</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm">http://www.kitware.com/Copyright.htm</a> for details.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> This software is distributed WITHOUT ANY WARRANTY; without even</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> PURPOSE. See the above copyright notice for more information.</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">MODIFIED by Eric Wait for Stereoscopic viewing</font></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; ">=========================================================================*/</span></div><div><font class="Apple-style-span" face="'courier new', monospace"><div>
#include "vtkConeSource.h"</div><div>#include "vtkPolyDataMapper.h"</div><div>#include "vtkRenderWindow.h"</div><div>#include "vtkCamera.h"</div><div>#include "vtkActor.h"</div>
<div>#include "vtkRenderer.h"</div><div><div>int main(){</div><div> vtkConeSource *cone = vtkConeSource::New();</div><div> cone->SetHeight( 3.0 );</div><div> cone->SetRadius( 1.0 );</div><div> cone->SetResolution( 100 );</div>
<div><br></div><div> vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();</div><div> coneMapper->SetInputConnection( cone->GetOutputPort() );</div><div><br></div><div> vtkActor *coneActor = vtkActor::New();</div>
<div> coneActor->SetMapper( coneMapper );</div><div><br></div><div> vtkRenderer *ren1= vtkRenderer::New();</div><div> ren1->AddActor( coneActor );</div><div> ren1->SetBackground( 0.1, 0.2, 0.4 );</div><div><br>
</div><div> vtkRenderWindow *renWin = vtkRenderWindow::New();</div><div> renWin->AddRenderer( ren1 );</div><div> renWin->SetStereoTypeToCrystalEyes();</div><div> renWin->SetStereoCapableWindowOn();</div><div>
renWin->SetStereoRender(1);</div><div><br></div><div> renWin->SetFullScreen(1);</div><div> </div><div> //renWin->SetSize( 300, 300 );</div><div><br></div><div> int i;</div><div> for (i = 0; i < 1000; ++i){</div>
<div> renWin->Render();</div><div> ren1->GetActiveCamera()->Azimuth(1);</div><div> }</div><div><br></div><div> cone->Delete();</div><div> coneMapper->Delete();</div><div> coneActor->Delete();</div>
<div> ren1->Delete();</div><div> renWin->Delete();</div><div><br></div><div> return 0;</div><div>}</div></div></font></div>