Another alpha release of SimVTK is ready, and can be downloaded from theĀ SimVTK site at Queen’s University. SimVTK is a visual programming environment for VTK inside of Matlab’s Simulink. This release adds support for Mac OS X.
I had my work cut out for me in getting VTK to work inside Matlab on OS X. Matlab uses four GUI toolkits (Java, Qt, Cocoa, and X11) and uses 24 independent threads. The Simulink thread (the one in which my VTK code is running) uses X11. But VTK is using Cocoa, and each Cocoa window that VTK creates responds to mouse/keyboard events from the main Matlab application thread. The result: every time I clicked in the window, VTK code would be called from the wrong thread. Boom. The solution was to write a "proxy" Cocoa window for VTK that queues the events, so that the Simulink/VTK thread doesn’t have deal with the events until it is good and ready.