[vtkusers] How to use vtkCamera GetProjectionTransformMatrix

Umer Rafi umer.rafi at rwth-aachen.de
Wed Jun 5 03:46:31 EDT 2013


Hi Everyone,
  
   I am new to VTK. I am trying to get the camera projection matrix for a scene by using vtk Camera GetProjectionTransformMatrix. The code I am using is given below.

  vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
  renderer->GetActiveCamera()->SetFocalPoint(0,.5,0);
  renderer->GetActiveCamera()->SetPosition(0,.5,3);
  renderer->GetActiveCamera()->SetClippingRange(2,6);
  double *aspect = renderer->GetAspect();
  vtkMatrix4x4 *Proj;
  Proj = renderer->GetActiveCamera()->GetProjectionTransformMatrix(aspect[0]/aspect[1],2,6) ;

 The matrix that I am getting is given below 

 3.73205 0 0 0 
 0 0 0 0 
 0 0 0 5.69215e-317 
 5.69324e-317 2.12448e-322 0 0 

 I get the same matrix even If I change the near and far value to (0,1) in  GetProjectionTransformMatrix. That means I am doing some thing very wrong. I will really appreciate any help in this regard.

Thanks in advance.

Regards




More information about the vtkusers mailing list