[vtk-developers] VTK-carbon on OS X 10.6

David Gobbi david.gobbi at gmail.com
Wed Sep 23 09:38:43 EDT 2009


Thanks for the insights, Sean.  I've managed to move one step forward.
 Compiling against Tk 8.4 fixed the window binding issue, and the
vtkTkRenderWidget seems to be working for the most part.
Unfortunately both versions of python on OS X 10.6 are linked to Tk
8.5, so the vtkTkRenderWidget can't be used through python.  It
segfaults when I try... no surprise there.

I'll look deeper into why Tk 8.5 is failing, because I'm not keen on
building my own python against Tk 8.4, and ideally we want the Carbon
build to work out-of-the-box on OS X 10.6.

Also, I committed my changes that allow VTK/Carbon to compile with Tk
8.5, the details are as follows:

 ===================================================================
 RCS file: /cvsroot/VTK/VTK/Rendering/vtkTkRenderWidget.cxx,v
 diff -r1.124 -r1.125
 1153c1153
 <     parentWin = GetWindowFromPort(TkMacOSXGetDrawablePort(
 ---
 >     parentWin = GetWindowFromPort((CGrafPtr)TkMacOSXGetDrawablePort(
 ===================================================================
 RCS file: /cvsroot/VTK/VTK/Rendering/vtkTkImageViewerWidget.cxx,v
 diff -r1.83 -r1.84
 822c822
 <       parentWin = GetWindowFromPort(TkMacOSXGetDrawablePort(
 ---
 >       parentWin = GetWindowFromPort((CGrafPtr)TkMacOSXGetDrawablePort(
 ===================================================================

 - David


On Tue, Sep 22, 2009 at 4:17 PM, Sean McBride <sean at rogue-research.com> wrote:
> On 9/22/09 4:02 PM, David Gobbi said:
>
>>Line 1152 in vtkTkRenderWidget.cxx and line 822 in
>>vtkTkImageViewerWidget.cxx, both needed typecasts as follows:
>>
>>parentWin = GetWindowFromPort((OpaqueGrafPtr*)TkMacOSXGetDrawablePort(
>>                                    Tk_WindowId(
>>                                    (OpaqueGrafPtr*)winPtr->parentPtr)));
>>
>>This code is only compiled when VTK_WRAP_TCL and VTK_USE_CARBON are
>>set, and AFAIK the type casts are only needed under OS X 10.6.
>
> Using a tool like Araxis Merge to diff the entire 8.4 folder against the
> 8.5 folder is instructive.  TkMacOSXGetDrawablePort() was indeed changed
> from returning a GWorldPtr to returning a void*.  A GWorld is a
> QuickDraw (Carbon) data type which has been deprecated for years.
> Presumably when/if Tk switches to Cocoa it will return some Cocoa object
> instead.
>
>>Because on the mac, Tk is built with Carbon.  There is an experimental
>>version of Tk that uses Cocoa that I'm going to try, but of course the
>>OS X Tk code in VTK is Carbon specific, so VTK won't be able to use it
>>without some serious modifications.
>
> So even 10.6's Tk 8.5 is still using Carbon?
>
> Good luck!  Looks like you are breaking new ground. :)
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
>



More information about the vtk-developers mailing list