[vtkusers] How to do a clean render-loop?

Lam Ha Hoang kei at gmx.ch
Sat Dec 15 06:17:49 EST 2007


Hello everyone

I am having trouble with my render-loop. Since there is no interactivity with the render-window itself I would like to do it without a vtkRenderWindowInteractor (or is this a bad idea?).

What I want to do is quite simple: I have a external tracking-device, which gives in the coordinates for a rendered object in real-time.

My code looks like this:
ren1 = vtkRenderer::New();
renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
ren1->AddActor(cubeActor);
ren1->AddActor(sphereActor2);
ren1->SetBackground(10, 10, 10);
renWin->SetSize(300, 300);
renWin->Render();

then comes the render-loop:

while (isRunning)
	{
	vtkSphereSource *sphere2 = vtkSphereSource::New();
		double theRotation = myRotation.rotating();
		cubeActor->RotateX(theRotation);
		renWin->Render();
		Sleep(10);
	}

At least it works, but the problem is, that the render-window is always idle. Is there a cleaner way to do this?

Thanks in advance
Lam
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger



More information about the vtkusers mailing list