[vtkusers] vtkWin32RenderWindowInteractor problems

Carl Hetherington lists at carlh.net
Wed Apr 3 05:15:50 EST 2002


Hi,

I am writing a Win32 task and there is one window that I want VTK to
plot.

The relevant bits of the setup code are:

  render = vtkRenderer::New();
  vtkw = vtkRenderWindow::New();
  /* window is the HWND of my task's window */
  vtkw->SetWindowId(reinterpret_cast<void*>(window);
  vtkw->AddRenderer(render);

  render->AddActor(act);
  render->SetActiveCamera(camera);
  render->ResetCamera();

  interact = vtkWin32RenderWindowInteractor::New();
  interact->SetRenderWindow(vtkw);
  interact->SetInstallMessageProc(false);
  interact->Initialize();

Now I also respond to some window events as follows:

case WM_LBUTTONDOWN:
  interact->OnLButtonDown(window, 0, LOWORD(lparam), HIWORD(lparam));
  break;

case WM_LBUTTONUP:
  interact->OnLButtonUp(window, 0, LOWORD(lparam), HIWORD(lparam));
  break;

case WM_MOUSEMOVE:
  interact->OnMouseMove(window, 0, LOWORD(lparam), HIWORD(lparam));
  break;

The scene plots fine but mouse rotation doesn't work.  Strangely, though,
the window responds correctly to being re-sized, even though I don't
explicitly pass the WM_SIZE event back to VTK.

Am I going about this the wrong way?  Can anyone help?

Thanks
Carl







More information about the vtkusers mailing list