[Insight-developers] FLTK, VTK, & OSX: workaround for multiple embedded VTK windows in a single FLTK window

John M. Galeotti jgaleotti at cmu . edu
Mon, 29 Sep 2003 12:38:28 -0400


As some of you are painfully aware, FLTK on Mac OSX does NOT support 
embedding multiple VTK windows in a single FLTK window.  It turns out 
that this is a "feature" of Carbon (thanks for pointing this out, 
Damion), and so as a workaround I have managed to get FLTK to compile 
as an X11 program on Mac.  When run as an X11 program, FLTK and VTK get 
along wonderfully, even on OSX!

As distributed, FLTK will not build as an X11 program for OSX.  To get 
FLTK to compile as an X11 program on Mac, do the following:

Start with a fresh copy of the fltk sources (this seems to be very 
important)
Go to the top-level fltk source directory
Replace configure.in with the attached file
Run autoconf
Proceed as normal with ./configure, make, etc...

Also, when building FLTK applications it will be necessary to remove 
any Carbon references from your CMakeLists.txt file.  Also, programs 
that use FlRenderWindowInteractor will require you to undefine the 
compilers __APPLE__ definition.  This can be done by adding the 
following line to your CMakeLists.txt file:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U__APPLE__")

John Galeotti
jgaleotti at cmu . edu