[vtkusers] vtkActor->SetUserMatrix doesn't work

Boettcher, Dr. Peter Boettcher at kleintierklinik.uni-leipzig.de
Fri Feb 6 06:10:54 EST 2004


Hi,
 
once more I try to solve the vtkActor->SetUserMatrix - Problem. The first time vtkActor->SetUserMatrix or vtkActor->SetUserTransform is called - it works. But each time I call it again with a modified matrix nothing happens.  The work around (http://vtk.org/pipermail/vtkusers/2003-January/015391.html) doesn't work for me.
 
Is there someone who could try my code on his machine? Maybe it is a local problem (WinXP, vtk4.2, VS6.0)?
 
Regards - Peter.
 
 
 
// Rotates a cube 360° around the z-axis
// SetUserMatrix is called: works only the first time ;-(
#include "vtk.h"
void main(void)
{
 vtkRenderer* ren = vtkRenderer::New();
 vtkRenderWindow* renWin = vtkRenderWindow::New();
 vtkActor* actor = vtkActor::New();
 vtkCubeSource * cube = vtkCubeSource::New();
 vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
 renWin->AddRenderer(ren);
 ren->AddActor(actor);
 mapper->SetInput(cube->GetOutput());
 actor->SetMapper(mapper);
  renWin->Render();
 

// ---------- Loop Rotation over the Z-axis -----------------//
 
 for(float i = 45; i < 360; i+=45)
 {
  vtkTransform* transform = vtkTransform::New();
  transform->RotateZ(i);
  actor->SetUserMatrix(transform->GetMatrix());
  actor->GetProperty()->SetColor((float)i/360, (float)i/360, (float)i/360);
  renWin->Render();
  transform->Delete();
  for(int ii = 0; ii<30000; ii++); 

 }

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040206/046eb278/attachment.htm>


More information about the vtkusers mailing list