[vtkusers] vtk 2D with MFC.

Ruby Shamir rubke at cs.huji.ac.il
Mon Aug 9 05:49:56 EDT 2004


Hello,

We tried to display 2D image in a picture element with MFC.

The image displayed fine when we did not changed the window's ID, what
is the problem?

Here is the code:

	bmpReader = vtkBMPReader::New();
      bmpReader->SetFileName("D:\\vtkExp\\femur1.bmp");

	vtkImageActor* act = vtkImageActor::New();
      act->SetInput(bmpReader->GetOutput());

	vtkRenderer* renderer = vtkRenderer::New();
	renderer->AddActor(act);

	CWnd* wind = GetDlgItem(IDC_PIC); // this is the inner element
which the image will display in

	vtkWin32OpenGLRenderWindow* renwin =
vtkWin32OpenGLRenderWindow::New();
	renwin->SetWindowId(wind->m_hWnd); // when deleting this line it
displays good but in other window.

	renwin->AddRenderer(renderer);
	renwin->Render();

Best regards,

   Ruby




More information about the vtkusers mailing list