Compiling TTGraphics for Mac OSX (HOWTO)

These instructions have been working on a system with:

  • Xcode 3.1.2 or higher installed
  • Running Mac OSX 10.5.6
  • MaxMSP 5.0.7
  • Able to compile the ordinary Jamoma externals in the usual way

Howto:

  1. Do an SVN update of Jamoma DSP
  2. Open the /DSP/extensions/TTGraphics/TTGraphics.xcodeproj project
  3. If you have attempted to build before, first do a "Clean All Targets", and then "Build" (Development)
  4. Next open /DSP/examples/MaxMSP/tt.graphics/tt.graphics.xcodeproj
  5. If you have attempted to build before, first do a "Clean All Targets", and then "Build" (Development)
  6. Next open /DSP/examples/MaxMSP/tt.graphicsui/tt.graphics.xcodeproj
  7. If you have attempted to build before, first do a "Clean All Targets", and then "Build" (Development)
  8. Start MaxMSP
  9. Open the help patches for tt.graphics and tt.graphicsui and test them out. Double-click tt.graphics to see what is going on in the dedicated graphical window.

Understanding Cairo

On the Mac, we use NSWindow for providing our context and mouse interaction:

Manually Compiling the Cairo Lib

Compiling Cairo for the Mac outside of X11 is annoying. For version 1.8.6, the following seems to at least compile (though who knows if it works):

./configure --enable-quartz-image --enable-test-surfaces --without-x
make
sudo make install

# find the build in /usr/local/lib, /usr/local/includes, etc.

The Quartz backend seems to be experimental. So if you run

make check

after the make, then you will see lots of fails and crashes. This does not instill confidence. Perhaps we should just use the X11 rendering and then copy the bitmap. That will be slower, and it may not look as good, but it might be more full featured?

API Notes

In Max's jgraphics there is a jgraphics_arc() function, as well as a jgraphics_ovalarc() which lets you have the arc inside an ellipse instead of a circle. You can get the same effect from jgraphics_arc() by using a transform that scales the two axes by different amounts. However, cairo doesn't have a cairo_ellipse() call at all. Everything is done with cairo_arc(). To draw a circle you tell it to go from 0 to 2pi. To draw an ellipse you apply a scale transform in different amounts to the x and y axes.

Mouse Interaction

Currently this is being handled on an ad-hoc basis. In particular, check the BlueButter AU plug-in. Also note the following references: