[vtkusers] MAC OS VTK WXWidgets

Clinton Stimpson clinton at elemtech.com
Thu Feb 16 13:11:10 EST 2006


> Date: Thu, 16 Feb 2006 17:03:22 +0100
> From: Jaonary Rabarisoa <jaonary at free.fr>
> Subject: [vtkusers] MAC OS VTK WXWidgets
> To: vtkusers at vtk.org
> 
> Hi all,
> I'm trying to port an application based on wxWidgets and VTK. This  
> application was initially developped on a linux box (wxGTK) and now  
> runs well on a windows box too. I'd like to port it on mac os but  
> using wxMAC instead of wxGTK.
> The problem that I have is that I probably need to pass a pointer to  
> an HIViewRef to the object vtkCarbonRenderWindow. This HIViewRef  
> pointer is obtained from the current wxGLcanvas, but I can't figure  
> out how to do this. Below, you can find the equivenlent code for  
> wxGTK and wxMSW. Note that with wxMSW we use a wxPanel instead of  
> wxGLcanvas, so the pointer "this" is a wxPanel* in this case.
> 
> rwin is a pointer to a vtk[WIN32,XOpenGL,Carbon]RenderWindow :
> 
> #ifdef __WXMSW__
> 		this->rwin->SetWindowId((HWND)this->GetHandle() );
> #elif __WXGTK__
> 		assert(GTK_WIDGET_MAPPED(m_wxwindow));
> #if (GTK_MAJOR_VERSION > 1)
> 		GdkWindow* bwin = (GdkWindow *)GTK_PIZZA(m_wxwindow)->bin_window;
> 		this->rwin->SetDisplayId(GDK_WINDOW_XDISPLAY(bwin));
> 		this->rwin->SetWindowId(GDK_WINDOW_XWINDOW(bwin));
> #else
> 		GdkWindowPrivate* bwin = (GdkWindowPrivate *)GTK_PIZZA(m_wxwindow)- 
>  >bin_window;
> 		this->rwin->SetDisplayId( bwin->xdisplay );
> 		this->rwin->SetWindowId( bwin->xwindow );
> #endif
> 
> If I use carbon with VTK, I need to pass an HIViewRef to the function  
> SetWindowId. So how can I get this from my current wxGLcanvas ?
> 
> Thank you for your help,
> 
> Jaonary

I'm no wx* expert, but I know some about Carbon.
In wxMac, wxWindow::GetHandle() returns a ControlRef which is the same as an HIViewRef.  ControlRef is the "old" style.
You might have problems using a wxGLcanvas with vtkCarbonRenderWindow, as both might step on each other's toes as they attempt to do OpenGL stuff.  A generic wxWindow or wxPanel might be better.

Clint





More information about the vtkusers mailing list