[vtkusers] Displaying large images in a MFC/VTK application

John Platt jcplatt at lineone.net
Tue Jan 20 05:37:39 EST 2004


Quoc Cuong,

As far as the render window is concerned, the differences in behaviour
are along the following lines.

A) - SetParentId(HWND) - vtk registers its own window class, creates a
new render window and replaces the WndProc() of the new window by
vtkHandleMessage()/vtkHandleMessage2() which handles useful
mouse/keyboard events. 

B) - SetWindowId(HWND) - vtk uses the supplied window for rendering. It
attempts to replace the WndProc() but cannot because MFC has a hold on
it (USER message WM_USER+12 is sent to the current event handler). If
you override WindowProc() in your CView derived class you should see the
messages. You can send these on to vtk using :

  if ( this->iren->GetInitialized()) 
  { 
      HWND hWnd = GetSafeHwnd();
      return vtkHandleMessage2( hWnd, uMsg, wParam, lParam, this->iren
); 
  }

It's not the complete picture but it may help.

-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
Of PHAM Quoc-Cuong 203899
Sent: 19 January 2004 13:58
To: 'vtkusers at vtk.org'
Subject: [vtkusers] Displaying large images in a MFC/VTK application

Dear vtk users,

I use a vtkImageViewer in a MFC/VTK application to display large images
(3000 x 2000) with some features such as scrolling and mouse
interaction.
The interaction is managed with vtkInteractorStyleUser and the messages
are
passed to vtk by WindowProc.

In my derived class CScrollView, I tried 2 ways to associate the render
window and the MFC view window:
A) with SetParentId(HWND) -> everything works fine with images of
reasonable
size (< 1280 x 1024), but becomes incredibly slow in the case of large
images / or the application crashes depending on the graphics card,
B) with SetWindowId(HWND) -> the display of large images is ok, but I
loose
the expected interactions (scrolling and wrong coordinates returned by
vtkInteractorStyle::OnMouseMove()).

Can anyone help me ?
Thanks,
==
Quoc Cuong PHAM
CEA/DRT/LIST/DTSI/SLA/LCEI
CEA Saclay F-91191 GIF sur Yvette Cedex France
tel : +33 (0)1 69 08 82 98
fax : +33 (0)1 69 08 83 95 
mail : quoc-cuong.pham at cea.fr 
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list